public RegisteredCategory Update(UpdateCategory updateRegistry) { using (LogisticDataContext logisticDataContext = new LogisticDataContext()) { var categoryToUpdate = updateRegistry.ToEntity(); logisticDataContext.Categories.Attach(categoryToUpdate); logisticDataContext.Entry(categoryToUpdate).State = System.Data.Entity.EntityState.Modified; logisticDataContext.SaveChanges(); return(categoryToUpdate.toDTO()); } }
public RegisteredProduct Update(UpdateProduct updateRegistry) { using (LogisticDataContext logisticDataContext = new LogisticDataContext()) { var productToEntity = updateRegistry.ToEntity(); logisticDataContext.Products.Attach(productToEntity); logisticDataContext.Entry(productToEntity).State = System.Data.Entity.EntityState.Modified; logisticDataContext.SaveChanges(); return(productToEntity.toDTO()); } }
public RegisteredWarehouse Update(UpdatedWarehouse updateRegistry) { using (LogisticDataContext logisticDataContext = new LogisticDataContext()) { var wareHouseEntity = updateRegistry.ToEntity(); logisticDataContext.Warehouses.Attach(wareHouseEntity); logisticDataContext.Entry(wareHouseEntity).State = System.Data.Entity.EntityState.Modified; logisticDataContext.SaveChanges(); return(wareHouseEntity.toDTO()); } }