コード例 #1
0
        /// <summary>
        /// This Action is a HttpGet method that returns an email for a reservation edition
        /// </summary>
        /// <param name="regularId">regular Id</param>
        /// <returns>A view</returns>
        public ActionResult EditionEmail(int regularId)
        {
            try {
                ShoppingCartViewModel vm = new ShoppingCartViewModel(regularId);

                return View(vm);
            }
            catch (Exception e) {

            //log.FatalError(e.Message);
                return new HttpNotFoundResult();
            }
        }
コード例 #2
0
        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();
        }
コード例 #3
0
        public ActionResult MemberEmail(int regularId)
        {
            Regular regular = db.Regulars.Find(regularId);

            try {
                vm = new ShoppingCartViewModel(regularId);
                regular.Count = vm.Count;
                regular.Cost = vm.TotalCost;
                db.SaveChanges();
                return View(vm);
            }
            catch (Exception e) {
               // log.FatalError(e.Message);
                return new HttpNotFoundResult();
            }
        }