コード例 #1
0
 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(){}};
 }
コード例 #2
0
        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);
            }
        }
コード例 #3
0
        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);
            }
        }
コード例 #4
0
        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);
            }
        }
コード例 #5
0
        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);
        }