Hi this is my code.. I just wonder if why I still encounter error in Category.Update even if the model is mapped all fields with Repository. The Category.Add works..
- protected DbContext _context { get; set; }
- public SupplierService(DbContext context){
- _context = context;
- }
- public void Create(CategoryModel model){
- _context.Categorys.Add(model.CovertToRepository());
- _context.SaveChanges();
- }
- public void Edit(CategoryModel model){
- _context.Category.Update(model.ConvertToRepository());
- _context.SaveChanges();
- }