public ActionResult HiddenQuestion(int id)
        {
            var question = _questionRepository.GetID(id);

            question.IsHidden = !question.IsHidden;
            _questionRepository.Update(question);
            return(new HttpStatusCodeResult(System.Net.HttpStatusCode.OK));
        }
Пример #2
0
        public ActionResult Edit(ExtendCreateDTO req)
        {
            Response res = new Response();

            if (ModelState.IsValid)
            {
                try
                {
                    if (req.Id > 0)
                    {
                        res.Data = ExtendRepository.Update(req);
                    }
                    else
                    {
                        res.Data = ExtendRepository.Create(req);
                    }
                }
                catch (Exception ex)
                {
                    res.Message = ex.InnerException.Message;
                }
            }
            else
            {
                res.Data    = false;
                res.Message = string.Join(",", ModelState.SelectMany(ms => ms.Value.Errors).Select(e => e.ErrorMessage));
            }
            return(Json(res, JsonRequestBehavior.AllowGet));
        }
Пример #3
0
        public ActionResult Edit(ExtendCreateDTO req)
        {
            Response res = new Response();

            if (ModelState.IsValid)
            {
                try
                {
                    if (req.Id > 0)
                    {
                        res.Data = _extendRepository.Update(req);
                    }
                    else
                    {
                        var currentUser = OperatorProvider.Provider.GetCurrent();
                        req.R_Company_Id = currentUser.CompanyId.ToInt();
                        res.Data         = _extendRepository.Create(req);
                    }
                }
                catch (Exception ex)
                {
                    res.Message = ex.Message;
                }
            }
            else
            {
                res.Data    = false;
                res.Message = string.Join(",", ModelState
                                          .SelectMany(ms => ms.Value.Errors)
                                          .Select(e => e.ErrorMessage));
            }

            return(Json(res, JsonRequestBehavior.AllowGet));
        }