Пример #1
0
        public ActionResult Create(FormCollection collection,
            [MetaDataModelBinder("Content;ReadContent;Question;IsQuestionInFront;OptionA;OptionB;OptionC;OptionD;OptionE;CorrectMark;Answer")]
            MetaData meta)
        {
            try
            {
                string source = collection.GetString("Source");
                string categoryIDString = collection.GetString("CategoryID");
                string username = MembershipHelper.GetUserName();

                Question question;
                Result res = QuestionModel.CreateQuestion(categoryIDString, source, username, meta, out question);

                if (!res.IsSuccess)
                {
                    Response.Write(res.ErrorMessage);
                    Response.End();
                }

                // TODO: user Rate

                //Related
                //Knowledge
                //Tag
                string tags = collection["Tag"];
                TagService.GetTagProvider().Add(username, question.GetKeyId(), tags);

                //Answer

                return RedirectToAction("Index");
            }
            catch (Exception e)
            {
                throw e;
            }
        }