public ActionResult Create(ModulesModel objModel) { if (ModelState.IsValid) { try { objModel.CreatedBy = Convert.ToInt32(Session["UserId"]); int res = moduleBLL.AddEditModule(objModel); if (res != 0) { Session["Success"] = "Successfully Added The Record"; return(RedirectToAction("Index")); } } catch (Exception e) { throw e; } } Session["Error"] = "An Error has occured"; return(View(objModel)); }