public ActionResult EditChoreList(int Id = 0) { if (Session["User"] == null) { return(RedirectToAction("Index", "Register")); } var User = (_User)Session["User"]; User = new _User(UserRepository.RefreshAuthToken(User.AuthToken)); Session["User"] = User; ViewBag.User = User; if (!ChoreRepository.CanEditChoreList(User.Id, Id)) { throw new Exception("Unauthorized to edit chorelist"); } _ChoreList ChoreList = new _ChoreList(ChoreRepository.GetChoreList(Id)); if (ChoreList.StatusId == 2) { List <string> Reasons = ChoreRepository.GetInActiveReasons(Id); ViewBag.InActiveReasons = Reasons; } ViewBag.User = User; ViewBag.ChoreList = ChoreList; return(View()); }
public HttpResponseMessage GetChoreList(int Id) { try { return(OKResponse(new _ChoreList(ChoreRepository.GetChoreList(Id)))); } catch (Exception ex) { return(ErrorResponse(ex)); } }