public void GetDrivers() { var cs = ConfigurationManager.ConnectionStrings["SqlServerConnectionString"].ConnectionString; var Obj_DriversDetails = new List <DriversDetails>(); using (var con = new SqlConnection(cs)) { var cmd = new SqlCommand("ordering_drivers_list", con) { CommandType = CommandType.StoredProcedure }; con.Open(); var dr = cmd.ExecuteReader(); while (dr.Read()) { var ObjDriversDetails = new DriversDetails { driver_id = Convert.ToInt32(dr[0].ToString()), driver_name = dr[1].ToString(), username = dr[2].ToString(), phone = dr[3].ToString(), status = dr[4].ToString(), update_date = dr[5].ToString(), }; Obj_DriversDetails.Add(ObjDriversDetails); } } var js = new JavaScriptSerializer(); Context.Response.Write(js.Serialize(Obj_DriversDetails)); }
public ActionResult Submit(DriversDetails dd) { if (ModelState.IsValid) { DriversDetailsList ddList = new DriversDetailsList(); DriversDetails driversDetails = ddList.GetDriversDetails(dd); if (driversDetails != null) { if ((driversDetails.ExpirateDate - DateTime.Now).TotalDays < 60) { return(View("DriversDetails", driversDetails)); } else { ModelState.AddModelError("ExpirateDate", "The expiration is more than 60 days, it should be less than 60 days"); } } else { ModelState.AddModelError("DriverLastName", "The Name and LicenceID are incorrect"); } } return(View("Renewal")); }
public ActionResult Payment(DriversDetails model) { var Lid = model.LicenceID; ViewBag.LicenceID = Lid.ToString(); return(View("PaymentInfo")); }