Esempio n. 1
0
        public ActionResult SendShippingNotice(Shipment shipment)
        {
            ViewBag.Items = Shipment.Items();

            shipment.Validate(ModelState, User);

            if (ModelState.IsValid)
            {
                ShippingNotice shippingNotice = new ShippingNotice(shipment);

                if (TryValidateModel(shippingNotice))
                {
                    Mailer mailer = new Mailer(MessageTemplate.Default, true);

                    mailer.SetFromAddress(shipment.ShippersEmail);
                    mailer.AddRecipient(shipment.RecipientsEmail);
                    mailer.AddRecipient(shipment.ManagersEmail);
                    mailer.SendMessage("ShippingNotice", shippingNotice, shippingNotice.Subject);

                    db.Shipments.Add(shipment);
                    db.SaveChanges();

                    ViewBag.Description = "Notice Sent";

                    return(View("Success"));
                }

                ModelState.AddModelError("MailNotice", "Mail Notice Error");
            }

            return(View(shipment));
        }
Esempio n. 2
0
 public ActionResult ShippingNotice(ShippingNotice shippingNotice)
 {
     return(View(shippingNotice));
 }