/// <summary> /// This Action is a HttpGet method that returns a email for a reservation cancellation /// </summary> /// <param name="regularId">Sent from the Regular controller after a cancellation</param> /// <returns>A view that has the view model information attached to it</returns> public ActionResult CancellationEmail(int regularId) { try { CancellationViewModel vm = new CancellationViewModel(regularId); return View(vm); } catch (Exception e) { // log.FatalError(e.Message); return new HttpNotFoundResult(); } }
public ActionResult SendEmail(int regularId, string email, bool cancellation = false, bool edit = false) { var regular = db.Regulars.Find(regularId); ViewBag.HHID = regular.HHID; ViewBag.MemberId = regular.MemberId; ViewBag.selectedDateParam = regular.Date; regular.Cost = meth.calculateTripCost(regularId); regular.Count = meth.CountGuests(regularId); db.SaveChanges(); //If the email is a regular email, then the vm is created if (cancellation == false) { if (edit == false) { vm = new ShoppingCartViewModel(regularId); // this script calls the RenderViewToString method to call the // MemberEmail view and insert the ShoppingCart model //then write it to a string of html for the EmailService this._body = RenderViewToString("MemberEmail", vm); } else { vm = new ShoppingCartViewModel(regularId); // this script calls the RenderViewToString method to call the // EditEmail view and insert the ShoppingCart model //then write it to a string of html for the EmailService this._body = RenderViewToString("EditionEmail", vm); } } else { cvm = new CancellationViewModel(regularId); // this script calls the RenderViewToString method to call the // CancellationEmail view and insert the ShoppingCart model //then write it to a string of html for the EmailService this._body = RenderViewToString("CancellationEmail", cvm); } //Calls the CreateMessage method from the Hermes.Method Project //that will take the body of html and a list of service.CreateMessage(_body, email); return View(); }