public ActionResult ReportPotholePost(PotholeViewModel viewModel) { if (!Request.IsAuthenticated) { return(RedirectToAction("Index")); } //Pothole pothole = new Pothole(); //pothole.UserName = userName; Pothole p = new Pothole(); p.UserName = viewModel.UserName; p.PotholeDesc = viewModel.PotholeDesc; p.Latitude = viewModel.Latitude; p.Longitude = viewModel.Longitude; p.Severity = viewModel.Severity; p.Street1 = viewModel.Street1; p.Street2 = viewModel.Street2; p.LocationDesc = viewModel.LocationDesc; p.ReportedDate = viewModel.ReportedDate; p.InspectedDate = viewModel.InspectedDate; p.RepairedDate = viewModel.RepairedDate; p.IsValidated = Convert.ToBoolean(viewModel.IsValidated); bool confirm = potholeDAL.ReportPothole(p); return(RedirectToAction("Index", "Home")); }
public ActionResult Report(PotholeModel newPothole) { int userId = ((User)Session["user"]).UserId; DateTime now = DateTime.Now; newPothole.WhoReported = userId; newPothole.ReportDate = now; potholeDAL.ReportPothole(newPothole); return(RedirectToAction("Index", "Home")); }