private IdentityHTDefaultSetting ExtractCreateFormData(HTDefaultSettingCreateModel formData) { var myIdetity = new IdentityHTDefaultSetting(); myIdetity.Name = formData.Name; myIdetity.Code = formData.Code; myIdetity.EnumValue = formData.EnumValue; myIdetity.MaxLength = formData.MaxLength; myIdetity.StartPosition = formData.StartPosition; myIdetity.NumberOfCharacters = formData.NumberOfCharacters; myIdetity.Status = formData.Status; return(myIdetity); }
public ActionResult Create(HTDefaultSettingCreateModel model) { var newId = 0; 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 info var info = ExtractCreateFormData(model); newId = _mainStore.Insert(info); ////Clear cache //CachingHelpers.ClearHTDefaultSettingCache(); if (newId > 0) { this.AddNotification(ManagerResource.LB_INSERT_SUCCESS, NotificationType.SUCCESS); } else { this.AddNotification(ManagerResource.ERROR_ENUMVALUE_EXISTED, NotificationType.ERROR); } } catch (Exception ex) { this.AddNotification(NotifSettings.Error_SystemBusy, NotificationType.ERROR); logger.Error("Failed for Create HTDefaultSetting request: " + ex.ToString()); return(View(model)); } return(RedirectToAction("Edit/" + newId)); }
public ActionResult Create() { var createModel = new HTDefaultSettingCreateModel(); return(View(createModel)); }