public ActionResult Order(PurchaseOrderDTO po)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    throw new Exception("IT Error: please contact your administrator");
                }

                //get PO
                var purchaseorder = _poRepo.GetById(po.PoNum);
                //update status and order date
                purchaseorder.Status    = Ordered;
                purchaseorder.OrderDate = po.OrderDate;
                if (po.OrderDate < po.CreateDate)
                {
                    throw new Exception("Record not saved, ordered date cannot be before created date");
                }

                //persist data
                _poRepo.Update(purchaseorder);
                return(RedirectToAction("Summary"));
            }
            catch (Exception e)
            {
                return(RedirectToAction("Order", new { p = po.PoNum.ToString(), error = e.Message }));
            }
        }
Example #2
0
        public void EditPO(POs PO)
        {
            var original = pORepository.GetById(p => p.PoId == PO.PoId);

            pORepository.Update(original, PO.AutoMapObject <POs, DB.POs>());
        }