Esempio n. 1
0
        private IdentityPropertyCategory ExtractEditFormData(PropertyCategoryEditModel formData)
        {
            var myIdetity = new IdentityPropertyCategory();

            myIdetity.Id = formData.Id;

            myIdetity.Name   = formData.Name;
            myIdetity.Code   = formData.Code;
            myIdetity.Status = formData.Status;

            return(myIdetity);
        }
Esempio n. 2
0
        private PropertyCategoryEditModel RenderEditModel(IdentityPropertyCategory identity)
        {
            var editModel = new PropertyCategoryEditModel();

            editModel.Id         = identity.Id;
            editModel.Name       = identity.Name;
            editModel.Code       = identity.Code;
            editModel.Status     = identity.Status;
            editModel.Properties = identity.Properties;

            return(editModel);
        }
Esempio n. 3
0
        public ActionResult Edit(PropertyCategoryEditModel model)
        {
            if (!ModelState.IsValid)
            {
                string messages = string.Join("; ", ModelState.Values
                                              .SelectMany(x => x.Errors)
                                              .Select(x => x.ErrorMessage + x.Exception));
                this.AddNotification(messages, NotificationType.ERROR);
                return(View(model));
            }

            try
            {
                //Extract data
                var info = ExtractEditFormData(model);

                var isSuccess = _mainStore.Update(info);

                //Clear cache
                CachingHelpers.ClearPropertyCategoryCache();

                if (isSuccess)
                {
                    this.AddNotification(ManagerResource.LB_UPDATE_SUCCESS, NotificationType.SUCCESS);
                }
            }
            catch (Exception ex)
            {
                this.AddNotification(NotifSettings.Error_SystemBusy, NotificationType.ERROR);

                logger.Error("Failed for Edit PropertyCategory request: " + ex.ToString());

                return(View(model));
            }

            return(RedirectToAction("Edit/" + model.Id));
        }