public ActionResult Delete(int Id) { using (ClientInfosEntities1 db = new ClientInfosEntities1()) { var clientinfo = db.ClientInfos.Find(Id); clientinfo.Removed = DateTime.Now; db.SaveChanges(); } return(RedirectToAction("Index")); }
public ActionResult ClientInfo(string firstName, string lastName, string emailAddress, DateTime dateofbirth, int carYear, string carMake, string carModel, string checkDUI, int speedTickets, string checkCoverage) { if (string.IsNullOrEmpty(firstName) || string.IsNullOrEmpty(lastName) || string.IsNullOrEmpty(emailAddress)) { return(View("~/Views/Shared/Error.cshtml")); } else { using (ClientInfosEntities1 db = new ClientInfosEntities1()) { var clientinfo = new ClientInfo(); clientinfo.FirstName = firstName; clientinfo.LastName = lastName; clientinfo.EmailAddress = emailAddress; clientinfo.CarYear = carYear; clientinfo.CarMake = carMake; clientinfo.CarModel = carModel; if (checkDUI == null) { clientinfo.CheckDUI = "no"; } else { clientinfo.CheckDUI = "yes"; } clientinfo.SpeedTickets = speedTickets; if (checkCoverage == null) { clientinfo.CheckCoverage = "no"; } else { clientinfo.CheckCoverage = "yes"; } CalculateQuote(dateofbirth, carYear, carMake, carModel, checkDUI, speedTickets, checkCoverage); decimal?x = quoteTotal; double quotePrice = (double)x; clientinfo.QuoteTotal = x; db.ClientInfos.Add(clientinfo); db.SaveChanges(); } } Display(); return(View("ViewQuote")); }
public ActionResult Display() { using (ClientInfosEntities1 db = new ClientInfosEntities1()) { var clientinfo = db.ClientInfos.OrderByDescending(x => x.Id).FirstOrDefault(); var clientquoteVMs = new List <ClientQuoteVM>(); { var clientquoteVM = new ClientQuoteVM(); // casting decimal?x = clientinfo.QuoteTotal; double quotePrice = (double)x; clientquoteVM.QuoteTotal = quotePrice; clientquoteVMs.Add(clientquoteVM); } return(View(clientquoteVMs)); } }
// GET: Client public ActionResult Index() { using (ClientInfosEntities1 db = new ClientInfosEntities1()) { //var clientinfos = db.ClientInfos.Where(Id => Max(Id)).ToList(); var clientinfo = db.ClientInfos.OrderByDescending(x => x.Id).FirstOrDefault(); var clientquoteVMs = new List <ClientQuoteVM>(); //foreach (var clientinfo in clientinfos) { var clientquoteVM = new ClientQuoteVM(); decimal?x = clientinfo.QuoteTotal; double quotePrice = (double)x; clientquoteVM.QuoteTotal = quotePrice; clientquoteVMs.Add(clientquoteVM); } return(View(clientquoteVMs)); } }
// GET: Admin public ActionResult Index() { using (ClientInfosEntities1 db = new ClientInfosEntities1()) { var clientinfos = db.ClientInfos.Where(x => x.Removed == null).ToList(); var clientinfoVMs = new List <ClientInfoVM>(); foreach (var clientinfo in clientinfos) { var clientinfoVM = new ClientInfoVM(); clientinfoVM.Id = clientinfo.Id; clientinfoVM.FirstName = clientinfo.FirstName; clientinfoVM.LastName = clientinfo.LastName; clientinfoVM.EmailAddress = clientinfo.EmailAddress; decimal?x = clientinfo.QuoteTotal; double quotePrice = (double)x; clientinfoVM.QuoteTotal = quotePrice; clientinfoVMs.Add(clientinfoVM); } return(View(clientinfoVMs)); } }