public void addReq(GovernModel um) { using (var context = new toletBDdbEntities1()) { Govern users = new Govern() { users_id = um.users_id, request = um.request }; context.Governs.Add(users); context.SaveChanges(); } }
public ActionResult ReqAdminPanel(GovernModel governModel) { if (Request["msg"] == "") { ModelState.AddModelError(String.Empty, "Any of the fields can not be empty"); return(View()); } else if (ModelState.IsValid) { GovernModel g = new GovernModel() { users_id = User.Identity.Name, request = Request["msg"] }; governRep.addReq(g); } return(RedirectToAction("Index")); }