public ActionResult Create(ManageLabModel model) { string error = string.Empty; if (!ModelState.IsValid) { return(View(model)); } try { if (LabMember.Add(model.LabName, model.LabNameShort, model.Sequence, BaseContext.CurrentUser.UserName, out error)) { return(RedirectToAction("Index", new { Message = string.Format("Lab '{0}' successfully created.", model.LabName) })); } else { return(RedirectToAction("Create", new { Message = error })); } } catch (Exception ex) { return(RedirectToAction("Create", new { Message = ex.Message })); } }
/// <summary> /// GET: ManageLab/Edit/5 /// </summary> /// <param name="id"></param> /// <param name="message"></param> /// <returns></returns> public ActionResult Edit(int id, string message) { ViewBag.StatusMessage = message; ManageLabModel model = LabMember.Get(id); return(View(model)); }
public ActionResult Delete(int id, ManageLabModel model) { string error = string.Empty; try { model = LabMember.Get(id); if (LabMember.Delete(id, BaseContext.CurrentUser.UserName, out error)) { return(RedirectToAction("Index", new { Message = string.Format("Lab '{0}' successfully deleted.", model.LabName) })); } else { return(RedirectToAction("Delete", new { Message = error })); } } catch (Exception ex) { return(RedirectToAction("Delete", new { Message = ex.Message })); } }