Exemple #1
0
        /// <summary>
        /// Displays the information for one specific request
        /// </summary>
        /// <param name="id">ID of the request needing to be displayed</param>
        /// <returns>Returns a result based on status</returns>
        public ActionResult RequestDetails(int id)
        {
            ActionResult response;

            //check for admin
            if (Session["RoleID"] != null && (int)Session["RoleID"] == 6)
            {
                //if user is an admin, check id
                if (id > 0)
                {
                    //if id is valid, access database
                    try
                    {
                        //access database, map to view model
                        RequestDO requestDO = _RequestDataAccess.ViewRequestByID(id);

                        RequestPO requestPO = _RequestMapper.MapDOtoPO(requestDO);

                        response = View(requestPO);
                    }
                    catch (Exception ex)
                    {
                        //log error
                        _Logger.ErrorLog(MethodBase.GetCurrentMethod().DeclaringType.Name, MethodBase.GetCurrentMethod().Name, ex);
                        response = RedirectToAction("Error", "Home");
                    }
                    finally { }
                }
                else
                {
                    //if id is not valid, return to list of requests
                    response = RedirectToAction("Index", "Request");
                }
            }
            else
            {
                //if user is not an admin, redirect to login page
                response = RedirectToAction("Login", "Account");
            }

            return(response);
        }