예제 #1
0
 public List <RegisteredCategory> List()
 {
     using (LogisticDataContext logisticDataContext = new LogisticDataContext())
     {
         return(logisticDataContext.Categories.ToList().Select(x => x.toDTO()).ToList());
     }
 }
예제 #2
0
 public List <RegisteredMovementType> List()
 {
     using (LogisticDataContext logisticDataContext = new LogisticDataContext())
     {
         return(logisticDataContext.MovementTypes.ToList().Select(x => x.toDTO()).ToList());
     }
 }
예제 #3
0
 public List <RegisteredProduct> List()
 {
     using (LogisticDataContext logisticDataContext = new LogisticDataContext())
     {
         return(logisticDataContext.Products.Include("Category").ToList().Select(x => x.toDTO()).ToList());
     }
 }
예제 #4
0
 public List <RegisteredWarehouse> List()
 {
     using (LogisticDataContext logisticDataContext = new LogisticDataContext())
     {
         return(logisticDataContext.Warehouses.ToList().Select(x => x.toDTO()).ToList());
     }
 }
예제 #5
0
 public RegisteredProduct Create(CreateProduct newRegistry)
 {
     using (LogisticDataContext logisticDataContext = new LogisticDataContext())
     {
         var newProduct = newRegistry.ToEntity();
         logisticDataContext.Products.Add(newProduct);
         logisticDataContext.SaveChanges();
         return(newProduct.toDTO());
     }
 }
예제 #6
0
 public RegisteredCategory Create(CreateCategory newRegistry)
 {
     using (LogisticDataContext logisticDataContext = new LogisticDataContext())
     {
         var newCategory = newRegistry.ToEntity();
         logisticDataContext.Categories.Add(newCategory);
         logisticDataContext.SaveChanges();
         return(newCategory.toDTO());
     }
 }
예제 #7
0
 public RegisteredWarehouse Create(CreateWarehouse newRegistry)
 {
     using (LogisticDataContext logisticDataContext = new LogisticDataContext())
     {
         var newWareHouse = newRegistry.ToEntity();
         logisticDataContext.Warehouses.Add(newWareHouse);
         logisticDataContext.SaveChanges();
         return(newWareHouse.toDTO());
     }
 }
예제 #8
0
 public RegisteredMovement Create(CreateMovement newRegistry)
 {
     using (LogisticDataContext logisticDataContext = new LogisticDataContext())
     {
         var eMovement = newRegistry.ToEntity();
         logisticDataContext.Movements.Add(eMovement);
         logisticDataContext.SaveChanges();
         return(eMovement.ToDTO());
     }
 }
예제 #9
0
 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());
     }
 }
예제 #10
0
 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());
     }
 }
예제 #11
0
 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());
     }
 }