Beispiel #1
0
        public ActionResult Edit(long id, QuestionViewModel question)
        {
            try
            {
                // TODO: Add update logic here
                QuestionBAL _questionBAL = new QuestionBAL();
                Question    _question    = _questionBAL.GetQuestionById(id);

                _question.Title               = question.Title;
                _question.QuestionDetail      = question.QuestionDetail;
                _question.QuestionsCategoryId = question.QuestionsCategoryId;
                _question.Notification        = question.Notification;
                _question.GetCall             = question.GetCall;
                _question.ServiceLocationId   = question.ServiceLocationId;
                _question.UpdatedBy           = "Admin";
                _question.UpdatedDate         = DateTime.Now.ToUniversalTime();
                _questionBAL.UpdateQuestion(_question);

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
Beispiel #2
0
        //
        // GET: /Questions/Edit/5
        public ActionResult Edit(int id)
        {
            var         _categoryBAL = new CategoryBAL();
            QuestionBAL _questionBAL = new QuestionBAL();
            Question    _question    = _questionBAL.GetQuestionById(id);
            var         model        = new QuestionViewModel();

            model.Id                  = _question.Id;
            model.Title               = _question.Title;
            model.QuestionDetail      = _question.QuestionDetail;
            model.QuestionsCategoryId = _question.QuestionsCategoryId;
            model.ServiceLocationId   = _question.ServiceLocationId;
            model.StatusId            = _question.StatusId;
            model.Notification        = (bool)_question.Notification;
            model.GetCall             = (bool)_question.GetCall;
            model.FilePath            = _question.FilePath;
            model.CreatedBy           = _question.CreatedBy;
            model.CreatedDate         = _question.CreatedDate;
            model.IsActive            = _question.IsActive == true ? "True" : "False";
            model.UserId              = _question.UserId;

            List <QuestionsCategory> category = _categoryBAL.GetAllCategory();

            foreach (var i in category)
            {
                model.Category.Add(new SelectListItem
                {
                    Text  = i.Name,
                    Value = i.Id.ToString()
                });
            }

            return(View(model));
        }
Beispiel #3
0
        //
        // GET: /Questions/Details/5
        public ActionResult Details(long id)
        {
            var      _question = new QuestionBAL();
            Question question  = _question.GetQuestionById(id);
            var      model     = new QuestionViewModel();

            model.Id                  = question.Id;
            model.Title               = question.Title;
            model.IsActive            = question.IsActive.ToString();
            model.Notification        = (bool)question.Notification;
            model.QuestionDetail      = question.QuestionDetail;
            model.QuestionsCategoryId = question.QuestionsCategoryId;
            model.ServiceLocationId   = question.ServiceLocationId;
            model.StatusId            = question.StatusId;
            model.CreatedBy           = question.CreatedBy;
            model.CreatedDate         = question.CreatedDate;

            return(View(model));
        }