private IdentityPlaceTypeGroup ExtractCreateFormData(PlaceTypeGroupCreateModel formData) { var myIdetity = new IdentityPlaceTypeGroup(); myIdetity.GroupName = formData.Name; myIdetity.GroupCode = formData.Code; //myIdetity.UrlFriendly = UrlFriendly.ConvertToUrlFriendly(formData.Name); myIdetity.Icon = formData.Icon; myIdetity.FilterOnMap = Utils.ConvertToBoolean(formData.FilterOnMap); myIdetity.SortOrder = formData.SortOrder; myIdetity.Status = Utils.ConvertToInt32(formData.Status); myIdetity.CreatedBy = User.Identity.GetUserId(); return(myIdetity); }
public ActionResult Create(PlaceTypeGroupCreateModel 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 { //Begin db transaction var info = ExtractCreateFormData(model); newId = _mainStore.Insert(info); if (newId > 0) { this.AddNotification(ManagerResource.LB_INSERT_SUCCESS, NotificationType.SUCCESS); } else { this.AddNotification(NotifSettings.Error_SystemBusy, NotificationType.ERROR); } } catch (Exception ex) { this.AddNotification(NotifSettings.Error_SystemBusy, NotificationType.ERROR); logger.Error("Failed for Create PlaceTypeGroup request: " + ex.ToString()); return(View(model)); } return(RedirectToAction("Edit/" + newId)); }
//[AccessRoleChecker] public ActionResult Create() { var createModel = new PlaceTypeGroupCreateModel(); return(View(createModel)); }