public ActionResult DeleteLawyer(LawyerModelClass lmc) { try { JurisprudenceDBEntities _db = new JurisprudenceDBEntities(); tbl_Lawyer l = _db.tbl_Lawyer.Single(u => u.LawyerID == lmc.LawyerID); _db.tbl_Lawyer.Remove(l); _db.SaveChanges(); ViewBag.Message = "Deleted Successfully"; return(RedirectToAction("Lawyer")); } catch (Exception) { ViewBag.Message = "Some Error Occured!!"; return(View()); } }
public ActionResult CreateAccount(FormCollection fc) { if (ModelState.IsValid) { JurisprudenceDBEntities _db = new JurisprudenceDBEntities(); tbl_User umc = new tbl_User(); umc.Name = fc["name"]; umc.Email = fc["email"]; umc.Contact = fc["contact"]; umc.Address = fc["address"]; umc.Username = fc["username"]; umc.Password = fc["password"]; umc.AddedDate = DateTime.Now.ToShortDateString(); umc.IsActive = bool.Parse("True"); _db.tbl_User.Add(umc); _db.SaveChanges(); return(RedirectToAction("Login", "Home")); } return(View()); }