Ejemplo n.º 1
0
 public RegisteredProduct Create(CreateProduct newRegistry)
 {
     using (LogisticDataContext logisticDataContext = new LogisticDataContext())
     {
         var newProduct = newRegistry.ToEntity();
         logisticDataContext.Products.Add(newProduct);
         logisticDataContext.SaveChanges();
         return(newProduct.toDTO());
     }
 }
Ejemplo n.º 2
0
 public RegisteredCategory Create(CreateCategory newRegistry)
 {
     using (LogisticDataContext logisticDataContext = new LogisticDataContext())
     {
         var newCategory = newRegistry.ToEntity();
         logisticDataContext.Categories.Add(newCategory);
         logisticDataContext.SaveChanges();
         return(newCategory.toDTO());
     }
 }
Ejemplo n.º 3
0
 public RegisteredWarehouse Create(CreateWarehouse newRegistry)
 {
     using (LogisticDataContext logisticDataContext = new LogisticDataContext())
     {
         var newWareHouse = newRegistry.ToEntity();
         logisticDataContext.Warehouses.Add(newWareHouse);
         logisticDataContext.SaveChanges();
         return(newWareHouse.toDTO());
     }
 }
Ejemplo n.º 4
0
 public RegisteredMovement Create(CreateMovement newRegistry)
 {
     using (LogisticDataContext logisticDataContext = new LogisticDataContext())
     {
         var eMovement = newRegistry.ToEntity();
         logisticDataContext.Movements.Add(eMovement);
         logisticDataContext.SaveChanges();
         return(eMovement.ToDTO());
     }
 }
Ejemplo n.º 5
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());
     }
 }
Ejemplo n.º 6
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());
     }
 }
Ejemplo n.º 7
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());
     }
 }