protected virtual async Task Create(TrainingCategoryDto input) { TrainingCategory roleDto = MappingProfile.MappingConfigurationSetups().Map <TrainingCategory>(input); _context.TrainingCategory.Add(roleDto); await _context.SaveChangesAsync(); }
protected virtual async Task Update(TrainingCategoryDto input) { var users = await _context.UserProfile.Where(x => x.Id == input.Id).FirstOrDefaultAsync(); if (users != null) { TrainingCategory trainingCategoryDto = MappingProfile.MappingConfigurationSetups().Map <TrainingCategory>(input); _context.TrainingCategory.Update(trainingCategoryDto); await _context.SaveChangesAsync(); } }
public async Task CreateOrEditTrainingCategory(TrainingCategoryDto input) { if (input.Id == null || input.Id == 0) { await Create(input); } else { await Update(input); } }
public async Task <TrainingCategoryDto> GetTrainingCategoryForEdit(TrainingCategoryDto input) { var users = await _context.TrainingCategory.Where(x => x.Id == input.Id).FirstOrDefaultAsync(); if (users != null) { TrainingCategory roleDto = MappingProfile.MappingConfigurationSetups().Map <TrainingCategory>(input); _context.TrainingCategory.Update(roleDto); await _context.SaveChangesAsync(); return(MappingProfile.MappingConfigurationSetups().Map <TrainingCategoryDto>(roleDto)); } return(new TrainingCategoryDto()); }
public List <TrainingCategoryDto> GetAllTrainingCategory(TrainingCategoryDto input) { var allTrainingCategory = _context.TrainingCategory.ToList().Skip((input.PagedResultDto.Page - 1) * input.PagedResultDto.SkipCount).Take(input.PagedResultDto.MaxResultCount); List <TrainingCategoryDto> trainingCategoryDto = MappingProfile.MappingConfigurationSetups().Map <List <TrainingCategoryDto> >(allTrainingCategory); //Apply Sort trainingCategoryDto = Sort(input.PagedResultDto.Sort, input.PagedResultDto.SortOrder, trainingCategoryDto); // Apply search if (!string.IsNullOrEmpty(input.PagedResultDto.Search)) { trainingCategoryDto = trainingCategoryDto.Where(p => p.Status != null && p.Status.ToLower().ToString().ToLower().Contains(input.PagedResultDto.Search.ToLower()) || p.Name != null && p.Name.ToString().ToLower().Contains(input.PagedResultDto.Search.ToLower()) || p.DateCreated != null && p.DateCreated.ToString().ToLower().Contains(input.PagedResultDto.Search.ToLower()) ).ToList(); } return(trainingCategoryDto); }
public List <TrainingCategoryDto> GetAllTrainingCategory(TrainingCategoryDto input) { return(_unitOfWork.TrainingCategorys.GetAllTrainingCategory(input)); }
public async Task GetTrainingCategoryForEdit(TrainingCategoryDto input) { await _unitOfWork.TrainingCategorys.GetTrainingCategoryForEdit(input); }
public async Task CreateOrEditTrainingCategory(TrainingCategoryDto input) { await _unitOfWork.TrainingCategorys.CreateOrEditTrainingCategory(input); }