Ejemplo n.º 1
0
        public async Task <ActionResult> Index(VMEducation 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));
        }
Ejemplo n.º 2
0
        public ActionResult Edit(VMEducation model)
        {
            var isNew = model.Id == 0;

            if (ModelState.IsValid)
            {
                var redactModel = Mapper.Map <VMEducation, Education>(model);
                if (isNew)
                {
                    _repo.Create(redactModel);
                }
                else
                {
                    _repo.Update(redactModel);
                }

                return(RedirectToAction("Index"));
            }

            else
            {
                return(View(model));
            }
        }
        //Returns Education entry partial
        public ActionResult NewEducationEntry()
        {
            var education = new VMEducation();

            return(View("Partial/FormEntry/_NewEducationEntry", education));
        }