public async Task <PostOptionsDefaultViewModel> GetAllOptions() { var vm = new PostOptionsDefaultViewModel { TagViewModel = await GetAllTag().ConfigureAwait(false), CategoriesViewModel = await GetAllCategories().ConfigureAwait(false) }; return(vm); }
public async Task <PostOptionsDefaultViewModel> GetAllOptionsByPostId(int postId) { var tag = await _unitOfWork.Repository <PostOption>() .FindBy(po => po.OptionType.Equals(PostOptionType.PostTags) && po.Post.Id == postId) .SingleOrDefaultAsync(); var categories = await _unitOfWork.Repository <PostOption>() .FindBy(po => po.OptionType.Equals(PostOptionType.PostCategories) && po.Post.Id == postId) .SingleOrDefaultAsync(); var vm = new PostOptionsDefaultViewModel { TagViewModel = _mapper.Map <PostOption, PostOptionsViewModel>(tag), CategoriesViewModel = _mapper.Map <PostOption, PostOptionsViewModel>(categories) }; return(vm); }