Esempio n. 1
0
        public IActionResult Index(ProfileViewModel model, int page = 1, bool changeFilters = true)
        {
            if (changeFilters)
            {
                HttpContext.Session.SetOrUpdate <ProfileViewModel>("ProfileFilters", model);
            }
            else
            {
                model = HttpContext.Session.Get <ProfileViewModel>("ProfileFilters");
            }
            if (User.IsInRole("User"))
            {
                model.UserName = User.Identity.Name;
            }
            if (model.Status == "-")
            {
                model.Status = null;
            }
            if (model.SortType == "-")
            {
                model.SortType = null;
            }
            model.Page = page;
            model.Qty  = Qty;
            var result = ProfileLogic.GetProfile(model);

            if (result.GetModel != null)
            {
                return(View(result.GetModel));
            }
            TempData.AddOrUpdate("Error", result.GetErrorMessage);
            return(Redirect(Request.Headers["Referer"].ToString()));
        }