public ActionResult ChangeCompleted(int id, string rvDate, string rvTime, int rvNum, string Message) // id=ReservationId { bool sendSuccess = false; ViewBag.rvdate = rvDate; ViewBag.rvtime = rvTime; ViewBag.rvnum = rvNum; ViewBag.datetime = DateTime.Parse(rvDate).ToLongDateString() + " " + rvTime; if (Message == "Please note that not all requests can be accommodated.") { Message = ""; } Reservation oldRv = ReservationRepository.GetReservationById(id); ViewBag.datetime = DateTime.Parse(rvDate).ToLongDateString() + " " + rvTime; ReservationRepository.AddReservation(id, oldRv.BizRVInfoId, oldRv.FirstName, oldRv.LastName, oldRv.Phone, oldRv.Email, rvDate, rvTime, rvNum, Message, oldRv.AddedDate, oldRv.AddedBy, DateTime.Now, oldRv.UpdatedBy, true); Reservation r = ReservationRepository.GetReservationById(id); if (r != null) { EmailManager em = new EmailManager(); EmailContents ec = new EmailContents("FoodReady.Net", r.Email, Globals.Settings.ContactForm.MailFrom, "Reservation changed", EmailManager.BuildRVChangetoCustomer(r, oldRv)); em.FaxBody = EmailManager.BuildRVChangetoRestaurant(r, oldRv); em.SendFax(r.BizRVInfo.BizInfo.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 = r.BizRVInfo.BizInfo.ContactInfo.Email; // to restaurant; ec.FromEmailAddress = Globals.Settings.ContactForm.MailFrom; ec.Subject = "Reservation changed"; ec.Body = EmailManager.BuildRVChangetoRestaurant(r, oldRv); 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(oldRv)); }