public void SaveQuestion(HttpContext context) { string name = context.Request.Form["n"]; string story = context.Request.Form["s"]; string action = context.Request.Form["a"]; string id = context.Request.Form["id"]; if (string.IsNullOrEmpty(action)) { return; } else { UserEntity entity = UserAccount.Current; if (entity != null) { if (action == "create") { int ret = QuestionData.Create(new QuestionEntity() { authorid = entity.id, author = entity.name, title = name, story = story }); if (ret > 0) { EventFeed.CreateEvent(new EventEntity() { uid = entity.id, uname = entity.name, www = entity.www, //avatar = entity.avatar, }); } } else if (action == "edit") { } } } }
public ActionResult Create(FormCollection form, HttpPostedFileBase File) { if (!user.IsManager()) { return(View("Error")); } else { int id_subject = Convert.ToInt32(form["id_subject"]); int unit = Convert.ToInt32(form["unit"]); string content = form["content"]; string[] answer = new string[] { form["answer_a"], form["answer_b"], form["answer_c"], form["answer_d"] }; string answer_a = answer[0]; string answer_b = answer[1]; string answer_c = answer[2]; string answer_d = answer[3]; string correct_answer = form["correct_answer"]; bool add = qdata.Create(id_subject, unit, content, answer_a, answer_b, answer_c, answer_d, correct_answer); if (add) { TempData["status_id"] = true; TempData["status"] = "Add complete !"; } else { TempData["status_id"] = false; TempData["status"] = "Error, try again !"; } return(View()); } }