Esempio n. 1
0
 public MakeProduct UpdateMakeProduct(UpdateMakeProduct updateMakeProduct)
 {
     if (updateMakeProduct.AssemblyMmsId != null)
     {
         updateMakeProduct.AssemblyMms = _assemblyMmsRepository.
                                         GetAssemblyMms(updateMakeProduct.AssemblyMmsId);
     }
     if (updateMakeProduct.AuthorId != null)
     {
         updateMakeProduct.Author = _authorRepository
                                    .GetAuthor(updateMakeProduct.AuthorId.Value);
     }
     if (updateMakeProduct.WarehouseId != null)
     {
         updateMakeProduct.Warehouse = _warehouseRepository
                                       .GetWarehouse(updateMakeProduct.WarehouseId.Value);
     }
     return(_makeProductRepository.UpdateMakeProduct(updateMakeProduct));
 }
Esempio n. 2
0
        public MakeProduct UpdateMakeProduct(UpdateMakeProduct updateMakeProduct)
        {
            var makeProduct = _context.MakeProducts.Where(a => a.Id.Equals(updateMakeProduct.Id)).SingleOrDefault();

            if (makeProduct is null)
            {
                throw new Exception("");
            }

            if (updateMakeProduct.Author != null)
            {
                makeProduct.Author = updateMakeProduct.Author;
            }
            if (updateMakeProduct.AssemblyMms != null)
            {
                makeProduct.AssemblyMms = updateMakeProduct.AssemblyMms;
            }
            if (updateMakeProduct.Warehouse != null)
            {
                makeProduct.Warehouse = updateMakeProduct.Warehouse;
            }
            if (updateMakeProduct.ConfiguringProduct != null)
            {
                makeProduct.ConfiguringProduct =
                    updateMakeProduct.ConfiguringProduct;
            }


            if (updateMakeProduct.Date.HasValue)
            {
                makeProduct.Date = updateMakeProduct.Date.Value;
            }
            if (updateMakeProduct.NumberOfApplication != null)
            {
                makeProduct.NumberOfApplication = updateMakeProduct.NumberOfApplication;
            }


            _context.SaveChanges();

            return(makeProduct);
        }
Esempio n. 3
0
 public MakeProduct UpdateMakeProduct(UpdateMakeProduct makeProduct)
 {
     return(_makeProductService.UpdateMakeProduct(makeProduct));
 }