public List <RegisteredCategory> List() { using (LogisticDataContext logisticDataContext = new LogisticDataContext()) { return(logisticDataContext.Categories.ToList().Select(x => x.toDTO()).ToList()); } }
public List <RegisteredMovementType> List() { using (LogisticDataContext logisticDataContext = new LogisticDataContext()) { return(logisticDataContext.MovementTypes.ToList().Select(x => x.toDTO()).ToList()); } }
public List <RegisteredProduct> List() { using (LogisticDataContext logisticDataContext = new LogisticDataContext()) { return(logisticDataContext.Products.Include("Category").ToList().Select(x => x.toDTO()).ToList()); } }
public List <RegisteredWarehouse> List() { using (LogisticDataContext logisticDataContext = new LogisticDataContext()) { return(logisticDataContext.Warehouses.ToList().Select(x => x.toDTO()).ToList()); } }
public RegisteredProduct Create(CreateProduct newRegistry) { using (LogisticDataContext logisticDataContext = new LogisticDataContext()) { var newProduct = newRegistry.ToEntity(); logisticDataContext.Products.Add(newProduct); logisticDataContext.SaveChanges(); return(newProduct.toDTO()); } }
public RegisteredCategory Create(CreateCategory newRegistry) { using (LogisticDataContext logisticDataContext = new LogisticDataContext()) { var newCategory = newRegistry.ToEntity(); logisticDataContext.Categories.Add(newCategory); logisticDataContext.SaveChanges(); return(newCategory.toDTO()); } }
public RegisteredWarehouse Create(CreateWarehouse newRegistry) { using (LogisticDataContext logisticDataContext = new LogisticDataContext()) { var newWareHouse = newRegistry.ToEntity(); logisticDataContext.Warehouses.Add(newWareHouse); logisticDataContext.SaveChanges(); return(newWareHouse.toDTO()); } }
public RegisteredMovement Create(CreateMovement newRegistry) { using (LogisticDataContext logisticDataContext = new LogisticDataContext()) { var eMovement = newRegistry.ToEntity(); logisticDataContext.Movements.Add(eMovement); logisticDataContext.SaveChanges(); return(eMovement.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 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 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()); } }