public async Task <PageDto <AdminDto> > GetPageAsync(int pageSize, int pageNumber) { var page = new PageDto <AdminDto>(pageSize, pageNumber); var items = await _unitOfWork.Admins.GetPageAsync(pageSize, pageNumber); page.SetData(items.Item2, items.Item1.Select(i => AdminDto.FromDomain(i)).ToList()); return(page); }
public async Task <AdminDto> DeleteAsync(int id) { var admin = await Get(id); await _unitOfWork.CompleteAsync((ctx) => ctx.Admins.Remove(admin)); await _cacheStore.RemoveAsync(GetCacheKey(id)); return(AdminDto.FromDomain(admin)); }
public async Task <AdminDto> GetAsync(int id) { var adminDto = await _cacheStore.StoreAndGetAsync(GetCacheKey(id), async() => { var admin = await Get(id); return(AdminDto.FromDomain(admin)); }); return(adminDto); }