Esempio n. 1
0
 public string RemoveUnit_Of_Measurement(int id)
 {
     try
     {
         var item = Unit_Of_Measurements.FirstOrDefault(x => x.Unit_Of_MeasurementID == id);
         Unit_Of_Measurements.Remove(item);
         SaveChanges();
         return("Запись успешно удалена");
     }
     catch (Exception ex) { return(ex.Message); }
 }
Esempio n. 2
0
 public string EditUnit_Of_Measurement(int id, string full_name, string short_name)
 {
     try
     {
         var item = Unit_Of_Measurements.FirstOrDefault(x => x.Unit_Of_MeasurementID == id);
         if (item != null)
         {
             item.Full_Title  = full_name;
             item.Short_Title = short_name;
         }
         SaveChanges();
         return("Запись успешно отредактирована");
     }
     catch (Exception ex) { return(ex.Message); }
 }