Example #1
0
 public bool Update(int id, ItemVM itemVM)
 {
     if (string.IsNullOrEmpty(id.ToString()) || string.IsNullOrWhiteSpace(id.ToString())) // untuk mengecek inputan kosong/null
     {
         return(false);
     }
     else if (string.IsNullOrEmpty(itemVM.Name) || string.IsNullOrWhiteSpace(itemVM.Name)) // untuk mengecek inputan kosong/null
     {
         return(false);
     }
     else if (string.IsNullOrEmpty(itemVM.Stock.ToString()) || string.IsNullOrWhiteSpace(itemVM.Stock.ToString()))
     {
         return(false);
     }
     else if (string.IsNullOrEmpty(itemVM.Price.ToString()) || string.IsNullOrWhiteSpace(itemVM.Price.ToString()))
     {
         return(false);
     }
     else if (string.IsNullOrEmpty(itemVM.Suppliers_Id.ToString()) || string.IsNullOrWhiteSpace(itemVM.Suppliers_Id.ToString()))
     {
         return(false);
     }
     else
     {
         return(_itemPersistence.Update(id, itemVM));
     }
 }
Example #2
0
 public bool Update(int id, ItemVM itemVM)
 {
     if (string.IsNullOrEmpty(id.ToString()) || string.IsNullOrWhiteSpace(id.ToString()))
     {
         return(false);
     }
     else if (string.IsNullOrEmpty(itemVM.Name) || string.IsNullOrWhiteSpace(itemVM.Name))
     {
         return(false);
     }
     else if (string.IsNullOrEmpty(itemVM.Price.ToString()) || string.IsNullOrWhiteSpace(itemVM.Price.ToString()) || itemVM.Price < 0)
     {
         return(false);
     }
     else if (string.IsNullOrEmpty(itemVM.Stock.ToString()) || string.IsNullOrWhiteSpace(itemVM.Stock.ToString()) || itemVM.Stock < 0)
     {
         return(false);
     }
     else if (string.IsNullOrEmpty(itemVM.Suppliers_Id.ToString()) || string.IsNullOrWhiteSpace(itemVM.Suppliers_Id.ToString()))
     {
         return(false);
     }
     else
     {
         return(_itemPersistence.Update(id, itemVM));
     }
 }