public IdentityProjectCategory ExtractCreateFormData(ProjectCategoryCreateModel formData) { var myIdentity = new IdentityProjectCategory(); myIdentity.Code = formData.Code; myIdentity.Name = formData.Name; myIdentity.Status = formData.Status; return(myIdentity); }
public ActionResult Create(ProjectCategoryCreateModel 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 { 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 Product request: " + ex.ToString()); return(View(model)); } return(RedirectToAction("Create")); }
public ActionResult Create() { var createModel = new ProjectCategoryCreateModel(); return(View(createModel)); }