public async Task <ActionResult> Index(VMSituation filterModel, SxOrderItem order, int page = 1) { 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("_GridView", viewModel)); }
public ActionResult Edit(VMSituation model) { var isNew = model.Id == 0; if (ModelState.IsValid) { var redactModel = Mapper.Map <VMSituation, Situation>(model); if (isNew) { _repo.Create(redactModel); } else { _repo.Update(redactModel); } return(RedirectToAction("Index")); } else { return(View(model)); } }