public async Task<ActionResult> FindGridView(VMSiteTest filterModel, SxOrder order, int page = 1, int pageSize = 10)
        {
            var filter = new SxFilter(page, pageSize) { Order = order != null && order.Direction != SortDirection.Unknown ? order : null, WhereExpressionObject = filterModel };

            var viewModel = await _repo.ReadAsync(filter);
            if (page > 1 && !viewModel.Any())
                return new HttpNotFoundResult();

            ViewBag.Filter = filter;

            return PartialView("_FindGridView", viewModel);
        }
        public ActionResult Edit(VMSiteTest model)
        {
            var isArchitect = User.IsInRole("architect");
            var isNew = model.Id == 0;

            if (isNew || (!isNew && string.IsNullOrEmpty(model.TitleUrl)))
                model.TitleUrl = Url.SeoFriendlyUrl(model.Title);

            var redactModel = Mapper.Map<VMSiteTest, SiteTest>(model);
            if (ModelState.IsValid)
            {
                SiteTest newModel = null;
                if (isNew)
                    newModel = _repo.Create(redactModel);
                else
                {
                    if (isArchitect)
                        newModel = _repo.Update(redactModel, true, "Title", "Description", "Rules", "Type", "TitleUrl", "Show", "ShowSubjectDesc");
                    else
                        newModel = _repo.Update(redactModel, true, "Title", "Description", "Rules", "Show", "ShowSubjectDesc");
                }
                return RedirectToAction("Index");
            }
            else
                return View(model);
        }
 public ViewResult Edit(int? id)
 {
     var model = id.HasValue ? _repo.GetByKey(id) : new SiteTest();
     var viewModel = new VMSiteTest() {
         DateCreate=model.DateCreate,
         Description=model.Description,
         Id=model.Id,
         Rules=model.Rules,
         Show=model.Show,
         ShowSubjectDesc=model.ShowSubjectDesc,
         Title=model.Title,
         TitleUrl=model.TitleUrl,
         Type=model.Type,
         ViewsCount=model.ViewsCount
     };
     return View(viewModel);
 }