public GroceryKitViewModel AddGroceryKit(GroceryKitViewModel model)
        {
            try
            {
                model.IsValid = model.Validate();
                if (model.IsValid)
                {
                    //if (_bdmSvc.GroceryFormCodeExists(AppConstants.SITE_CODE, model.GroceryKit.GroceryKitCode))
                    //{
                    //    model.FieldId = "groupCode";
                    //    model.Message = string.Format(AppConstants.VALIDATION_ALREADY_EXISTS, "GroceryKit Code");
                    //    model.IsValid = false;
                    //}

                    //if (model.IsValid)
                    {
                        model.Form.SiteCode = AppConstants.SITE_CODE;
                        //_grocerySvc.AddForm(model.Form);

                        model = RefreshGroceryKit();
                        model.Message = string.Format(AppConstants.CRUD_CREATE, "GroceryKit");
                    }
                }
            }
            catch (Exception ex)
            {
                model.TranslateException(ex);
            }

            return model;
        }
 public GroceryKitViewModel GetAllGroceryKits()
 {
     var mod = new GroceryKitViewModel();
     try
     {
         mod = RefreshGroceryKit();
     }
     catch (Exception ex)
     {
         mod.TranslateException(ex);
     }
     return mod;
 }
        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;
        }