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); }
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); }
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)); }