private void FillSelf(Question model) { Id = model.Id; Manager = model.Manager; DateLimit = model.DateLimit; Descr = model.Descr; State = model.State; DateCreate = model.DateCreate; //NewPosition = new QuePosition(){Question = new Question(){}}; }
public ActionResult SetQuestionSent(Question que) { try { ResponseMessage responseMessage; //que.Creator = new Employee() { AdSid = GetCurUser().Id }; //que.NewPosition.Question = new Question(que.Id); bool complete = Question.SetQuestionSent(que.Id, out responseMessage); if (!complete) throw new Exception(responseMessage.ErrorMessage); return RedirectToAction("List", "Question"); } catch (Exception ex) { TempData["ServerError"] = ex.Message; return RedirectToAction("Index", que); } }
public ActionResult New(Question que) { DisplayCurUser(); try { ResponseMessage responseMessage; que.Creator = new Employee() { AdSid = GetCurUser().Id }; bool complete = que.Save(out responseMessage); if (!complete) throw new Exception(responseMessage.ErrorMessage); return RedirectToAction("Index", "Question", new { id = responseMessage.Id }); } catch (Exception ex) { ViewData["ServerError"] = ex.Message; return View("New", que); } }
public ActionResult SetQuestionAnswered(Question que) { try { ResponseMessage responseMessage; bool complete = Question.SetQuestionAnswered(que.Id, out responseMessage); if (!complete) throw new Exception(responseMessage.ErrorMessage); return RedirectToAction("List", "Question"); } catch (Exception ex) { TempData["ServerError"] = ex.Message; return RedirectToAction("Index", que); } }
public ActionResult Index(int? id) { DisplayCurUser(); Question que = new Question(); if (id.HasValue) { que = new Question(id.Value, true); } else { RedirectToAction("New"); } return View(que); }