public ActionResult editPollutionsdetails(tblpollution pol) { ViewBag.dist = de.tbldistricts.ToList(); ViewBag.cit = de.tblcities.ToList(); ViewBag.vereg = de.tblvehicleregs.ToList(); tblpollution ps = de.tblpollutions.Find(pol.pollutionid); ps.regid = pol.regid; ps.renewdate = pol.renewdate; de.SaveChanges(); return(RedirectToAction("listPollution")); }
public ActionResult PollutionVehicleReg(tblpollution pol) { int model = de.tblpollutions.Where(a => a.regid == pol.regid).Count(); if (model == 0) { ViewBag.dist = de.tbldistricts.ToList(); ViewBag.cit = de.tblcities.ToList(); ViewBag.vereg = de.tblvehicleregs.ToList(); int id = Convert.ToInt32(Session["logid"]); pol.loginid = id; de.tblpollutions.Add(pol); de.SaveChanges(); } else { TempData["dataalready"] = "Vehicle No has an active PUC certificate. To renew, edit the particular vehicle id"; } return(RedirectToAction("PollutionVehicleReg")); }