public JsonResult AutoBodyTypeSave(AutoBodyTypeViewModel autoBodyTypeViewModel) { if (autoBodyTypeViewModel.Id > 0) { var result = autoBodyTypeService.UpdateAutoBodyType(autoBodyTypeViewModel); return(Json(new { status = result == true ? "Update" : "fail", data = autoBodyTypeViewModel.Id })); } else { var result = autoBodyTypeService.AutoBodyTypeSave(autoBodyTypeViewModel); return(Json(new { status = result != null ? "save" : "exist", data = result })); } }
public AutoSolutionPageSet <AutoBodyTypeViewModel> GetAutoBodyType(AutoBodyTypeViewModel autoBodyTypeViewModel) { List <AutoBodyType> finalResult = new List <AutoBodyType>(); IQueryable <AutoBodyType> result = unitOfWork.GetAutoSolutionContext().AutoBodyType.AsQueryable(); if (autoBodyTypeViewModel.SearchTerm != null) { result = result.Where(x => x.BodyType.Contains(autoBodyTypeViewModel.SearchTerm)); } Pager pager = new Pager(result.Count(), autoBodyTypeViewModel.PageNo, autoBodyTypeViewModel.PageSize); finalResult = result.OrderBy(x => x.BodyType).Skip((pager.CurrentPage - 1) * pager.PageSize).Take(pager.PageSize).ToList(); AutoSolutionPageSet <AutoBodyTypeViewModel> autoSolutionPageSet = new AutoSolutionPageSet <AutoBodyTypeViewModel>() { Pager = pager, Data = autoMapper.Map <List <AutoBodyTypeViewModel> >(finalResult) }; return(autoSolutionPageSet); }
public bool UpdateAutoBodyType(AutoBodyTypeViewModel autoBodyTypeViewModel) { autoBodyType = autoMapper.Map <AutoBodyType>(autoBodyTypeViewModel); return(autoBodyTypeRepository.UpdateAutoBodyType(autoBodyType)); }
public AutoSolutionPageSet <AutoBodyTypeViewModel> GetAutoBodyType(AutoBodyTypeViewModel autoBodyTypeViewModel) { return(autoBodyTypeRepository.GetAutoBodyType(autoBodyTypeViewModel)); }
public AutoBodyTypeViewModel AutoBodyTypeSave(AutoBodyTypeViewModel autoBodyTypeViewModel) { autoBodyType = autoMapper.Map <AutoBodyType>(autoBodyTypeViewModel); return(autoBodyTypeRepository.SaveAutoBodyType(autoBodyType)); }
public IActionResult GetAutoBodyType(AutoBodyTypeViewModel autoBodyTypeViewModel) { AutoSolutionPageSet <AutoBodyTypeViewModel> result = autoBodyTypeService.GetAutoBodyType(autoBodyTypeViewModel); return(PartialView("_GetAutoBodyType", result)); }