public ActionResult Completed(RVConfirmationModel model) { bool sendSuccess = false; if (ModelState.IsValid) { if (model.Message == "Please note that not all requests can be accommodated.") { model.Message = ""; } BizInfo bi = BizInfoRepository.GetBizInfoById(model.BizInfoId); BizRVInfo brv = bi.GetBizRVInfo; model.Bizinfo = bi; ViewBag.biztitle = bi.BizTitle; ViewBag.datetime = DateTime.Parse(model.RVDate).ToLongDateString() + " " + model.RVTime; Reservation r = ReservationRepository.AddReservation(0, brv.BizRVInfoId, model.FirstName, model.LastName, model.Phone, model.Email, model.RVDate, model.RVTime, model.RVNum, model.Message, DateTime.Now, model.FirstName + model.LastName, DateTime.Now, model.FirstName + model.LastName, true); if (r != null) { EmailManager em = new EmailManager(); EmailContents ec = new EmailContents("FoodReady.Net", model.Email, Globals.Settings.ContactForm.MailFrom, "Restaurant Reservation", EmailManager.BuildRVtoCustomerHtmlBody(model)); em.FaxBody = EmailManager.BuildRVtoRestaurantHtmlBody(model); em.SendFax(bi.Fax); em.Send(ec); // send to customer if (em.IsSent == false) { sendSuccess = false; TempData["sentCustomerMsg"] = "Your message has not been sent out for some reasons."; } else { sendSuccess = true; TempData["sentCustomerMsg"] = "Your message has been sent out successfully."; } ec.FromName = "FoodReady.Net"; ec.To = bi.ContactInfo.Email; // to restaurant; ec.FromEmailAddress = Globals.Settings.ContactForm.MailFrom; ec.Subject = "Restaurant Reservation"; ec.Body = EmailManager.BuildRVtoRestaurantHtmlBody(model); em.Send(ec); if (em.IsSent == false) { sendSuccess = false; TempData["sentRestaurantMsg"] = "Your message has not been sent out for some reasons."; } else { sendSuccess = true; TempData["sentRestaurantMsg"] = "Your message has been sent out successfully."; } } else { sendSuccess = false; TempData["addToDBMsg"] = "Adding reservation to database failed for some reasons."; } } ViewBag.SendingSuccess = sendSuccess; return(View(model)); }