public GroceryKitViewModel() { Form = new FormDE(); Forms = new List<FormVw>(); MedicalProblems = new List<MedicalProblemBE>(); Occupations = new List<OccupationBE>(); MemberStatuses = new List<MemberStatusBE>(); }
public GroceryKitViewModel ModifyGroceryKit(FormDE mod) { GroceryKitViewModel model = new GroceryKitViewModel(); try { DBOperations op = mod.IsActive ? DBOperations.Update : DBOperations.Delete; mod.SiteCode = AppConstants.SITE_CODE; model.Form = mod; model.IsValid = model.Validate(); if (model.IsValid) { //_bdmSvc.ModifyGroceryKit(mod); model = RefreshGroceryKit(); model.Message = op == DBOperations.Update ? string.Format(AppConstants.CRUD_UPDATE, "GroceryKit") : string.Format(AppConstants.CRUD_DELETE, "GroceryKit"); } } catch (Exception ex) { model.TranslateException(ex); if (ex.Message.Contains("Store update, insert, or delete statement affected an unexpected number of rows (0). Entities may have been modified or deleted since entities were loaded. See http://go.microsoft.com/fwlink/?LinkId=472540 for information on understanding and handling optimistic concurrency exceptions.")) { model.IsActive = false; model.Message = "Unable to modify ExpenseGroup Code"; } } return model; }