예제 #1
0
        public ActionResult CheckoutSuccess()
        {
            int patronId = int.Parse(Request.Form["patron"]);

            Patron selectedPatron = Patron.Find(patronId);

            Copy selectedCopy = Copy.Find(int.Parse(Request.Form["copy-id"]));

            selectedPatron.AddCopy(selectedCopy);

            return(View(selectedPatron));
        }
        public ActionResult AddCopy(int patronId, int copyId)
        {
            Dictionary <string, object> model = new Dictionary <string, object>();
            Patron selectedPatron             = Patron.Find(patronId);
            Copy   copy = Copy.Find(copyId);

            selectedPatron.AddCopy(copy);
            copy.Edit(true);
            List <Copy> patronCopies = Patron.GetCopies(patronId);
            List <Copy> allCopies    = Copy.GetAll();

            model.Add("patronCopies", patronCopies);
            model.Add("allCopies", allCopies);
            model.Add("patron", selectedPatron);
            return(View("Show", model));
        }