Пример #1
0
        // Lånar om enskild bok
        public ActionResult Reloan(int index)
        {
            Auth _auth = new Auth((BorrowerWithUser)Session["User"]);

            if (_auth.HasUserPermission())
            {
                ActiveAndHistoryBorrows borrows = UserService.GetActiveAndHistoryBorrows(_auth.LoggedInUser.User.PersonId);
                BorrowService.RenewLoad(_auth.LoggedInUser.Borrower, borrows.Active[index].Borrow.Barcode);

                return(View("Start", borrows));
            }
            return(Redirect("/Error/Code/403"));
        }
        public ActionResult RenewLoan(string barcode, string personid, int index)
        {
            if (new Auth((BorrowerWithUser)Session["User"]).HasAdminPermission())
            {
                ActiveAndHistoryBorrows borrows = new ActiveAndHistoryBorrows();
                borrows.Active = BorrowService.GetActiveBorrowedBooks(personid);
                BorrowService.RenewLoad(BorrowerService.GetBorrower(personid), borrows.Active[index].Borrow.Barcode);

                TempData["AlertView"] = AlertView.Build("Lån är uppdaterade.", AlertType.Success);

                return(Redirect("/BorrowerAdmin/Borrower/" + personid));
            }
            return(Redirect("/Error/Code/403"));
        }