コード例 #1
0
 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 }));
     }
 }
コード例 #2
0
        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);
        }
コード例 #3
0
 public bool UpdateAutoBodyType(AutoBodyTypeViewModel autoBodyTypeViewModel)
 {
     autoBodyType = autoMapper.Map <AutoBodyType>(autoBodyTypeViewModel);
     return(autoBodyTypeRepository.UpdateAutoBodyType(autoBodyType));
 }
コード例 #4
0
 public AutoSolutionPageSet <AutoBodyTypeViewModel> GetAutoBodyType(AutoBodyTypeViewModel autoBodyTypeViewModel)
 {
     return(autoBodyTypeRepository.GetAutoBodyType(autoBodyTypeViewModel));
 }
コード例 #5
0
 public AutoBodyTypeViewModel AutoBodyTypeSave(AutoBodyTypeViewModel autoBodyTypeViewModel)
 {
     autoBodyType = autoMapper.Map <AutoBodyType>(autoBodyTypeViewModel);
     return(autoBodyTypeRepository.SaveAutoBodyType(autoBodyType));
 }
コード例 #6
0
        public IActionResult GetAutoBodyType(AutoBodyTypeViewModel autoBodyTypeViewModel)
        {
            AutoSolutionPageSet <AutoBodyTypeViewModel> result = autoBodyTypeService.GetAutoBodyType(autoBodyTypeViewModel);

            return(PartialView("_GetAutoBodyType", result));
        }