/// <summary> /// Refund order, based on order nr. /// </summary> /// <param name="ordernr">Order nr to remove</param> /// <returns>Orders</returns> public ActionResult RefundOrder(int ordernr) { try { #region IsAdminCheck if (Session["Kunde"] == null) { return(RedirectToAction("Frontpage", "Film")); } var user = (UserVM)Session["Kunde"]; int userId = user.Id; if (!_UserLogic.IsAdmin(userId)) { return(RedirectToAction("Frontpage", "Film")); } #endregion IsAdminCheck if (_orderLogic.RefundOrder(ordernr)) { var orders = _orderLogic.RemoveOrderNr(ordernr, (List <ExpandedOrderVM>)TempData["ExpandedOrderVM"]); TempData["message"] = "Ordre " + ordernr + " har blitt refundert"; return(View("Orders", orders)); } TempData["errormessage"] = "Noe gikk galt under refunderingen av ordrenr: " + ordernr; return(View("Orders", (List <ExpandedOrderVM>)TempData["ExpandedOrderVM"])); } catch (DatabaseErrorException e) { TempData["message"] = "Databasefeil. Se errorlog."; TempData["errormessage"] = e.GetMessage(); return(RedirectToAction("AdminFrontPage")); } }