public ActionResult Edit(int projectId, int resourceId, FormCollection collection) { var model = ProjectResourceEditCreator.GetProjectResourceEditCreator(projectId, resourceId).Result; try { model.Role = int.Parse(collection["Role"]); model = ProjectResourceUpdater.Update(projectId, model); return(RedirectToAction("Index", new { id = projectId })); } catch (Csla.DataPortalException ex) { if (ex.BusinessException != null) { ModelState.AddModelError("", ex.BusinessException.Message); } else { ModelState.AddModelError("", ex.Message); } ViewData.Add("Roles", new SelectList(ProjectTracker.Library.RoleList.GetList(), "Key", "Value")); ViewData.Model = model; return(View()); } catch (Exception ex) { ModelState.AddModelError("", ex.Message); ViewData.Add("Roles", new SelectList(ProjectTracker.Library.RoleList.GetList(), "Key", "Value")); ViewData.Model = model; return(View()); } }
public ActionResult Create(int projectId, FormCollection collection) { try { var resourceId = int.Parse(collection["ResourceId"]); var model = ProjectResourceEditCreator.GetProjectResourceEditCreator(resourceId).Result; model.Role = int.Parse(collection["Role"]); model = ProjectResourceUpdater.Update(projectId, model); return(RedirectToAction("Index", new { id = projectId })); } catch (Csla.DataPortalException ex) { if (ex.BusinessException != null) { ModelState.AddModelError("", ex.BusinessException.Message); } else { ModelState.AddModelError("", ex.Message); } return(Create(projectId)); } catch (Exception ex) { ModelState.AddModelError("", ex.Message); return(Create(projectId)); } }
// // GET: /ProjectResource/Delete/5 public ActionResult Delete(int projectId, int resourceId) { var model = ProjectResourceEditCreator.GetProjectResourceEditCreator(projectId, resourceId).Result; ViewData.Model = model; return(View()); }
// // GET: /ProjectResource/Edit/5 public ActionResult Edit(int projectId, int resourceId) { ViewData.Add("Roles", new SelectList(ProjectTracker.Library.RoleList.GetList(), "Key", "Value")); var model = ProjectResourceEditCreator.GetProjectResourceEditCreator(projectId, resourceId).Result; ViewData.Model = model; return(View()); }