public IEnumerable <MemberResources> Get(bool isArchive = false) { MemberStatus status = isArchive ? MemberStatus.Resigned : MemberStatus.Registered; return(service.ReadManyNoTracked <MemberResources>().Include(m => m.Bills) .Where(m => m.Status == status)); }
public IActionResult Till([FromServices] ICrudServices <CompanyDbContext> service) { var dto = new SellItemDto(); dto.SetResetDto(service.ReadManyNoTracked <StockSelectDto>().ToList()); return(View(dto)); }
public IActionResult Sales([FromServices] ICrudServices <CompanyDbContext> service) { var allSales = service.ReadManyNoTracked <ListSalesDto>().ToList(); var allTheSameShop = allSales.Any() && allSales.All(x => x.ShopName == allSales.First().ShopName); return(View(new Tuple <List <ListSalesDto>, bool>(allSales, allTheSameShop))); }
public IActionResult Till([FromServices] ICrudServices <CompanyDbContext> service, SellItemDto dto) { if (!ModelState.IsValid) { dto.SetResetDto(service.ReadManyNoTracked <StockSelectDto>().ToList()); return(View(dto)); } var result = service.CreateAndSave(dto); if (service.IsValid) { return(RedirectToAction("BuySuccess", new { message = service.Message, result.ShopSaleId })); } //Error state service.CopyErrorsToModelState(ModelState, dto); dto.SetResetDto(service.ReadManyNoTracked <StockSelectDto>().ToList()); return(View(dto)); }
public void OnGet(string message) { Message = message; var query = _service.ReadManyNoTracked <AuthorWithBookCountDto>() .OrderBy(x => x.Name).AsQueryable(); NumPages = (int)Math.Ceiling( (double)query.Count() / PageSize); PageNum = Math.Min( Math.Max(1, PageNum), NumPages); AuthorList = query.Page(PageNum - 1, PageSize); }
public async Task OnGetAsync(SortFilterPageOptions options) { var booksQuery = _service.ReadManyNoTracked <BookListDto>() .OrderBooksBy(options.OrderByOptions) .FilterBooksBy(options.FilterBy, options.FilterValue); await options.SetupRestOfDto(booksQuery); BooksList = await booksQuery.Page(options.PageNum - 1, options.PageSize).ToArrayAsync(); SortFilterPageData = options; }
public IPagedList <RequestLogIndexModel> IndexFilter(RequestLogIndexOptions options) { IQueryable <RequestLogIndexModel> items = _service.ReadManyNoTracked <RequestLogIndexModel>(); if (options.RequestLogId != null) { items = items.Where(m => m.RequestLogId == options.RequestLogId); } if (options.StartDate != null) { items = items.Where(m => m.RequestBegin >= options.StartDate); } if (options.EndDate != null) { items = items.Where(m => m.RequestBegin <= options.EndDate); } if (options.InProgress) { items = items.Where(m => m.ResponseMs == null); } if (!options.URL.IsNullOrWhitespace()) { items = items.Where(m => m.URL.Contains(options.URL)); } if (!options.IP.IsNullOrWhitespace()) { items = items.Where(m => m.IP.Contains(options.IP)); } if (!options.RequestMethod.IsNullOrWhitespace()) { items = items.Where(m => m.RequestMethod.Contains(options.RequestMethod)); } if (options.ResponseStatus != null) { items = items.Where(m => m.ResponseStatus == options.ResponseStatus); } items = items.OrderByDescending(i => i.RequestLogId); return(items.ToPagedList(options.CurrentPage, options.PageSize)); }
public async Task <IActionResult> Read() { var user = _services.ReadSingle <User>(a => a.Id == Guid.Parse("32feb0dd-6182-4dc0-9ad6-b147b6fb0cbb")); Console.WriteLine("--- user ---"); Console.WriteLine(user); var users = await _services.ReadManyNoTracked <User>().ToListAsync(); Console.WriteLine("--- users ---"); Console.WriteLine(JsonSerializer.Serialize(users)); var usersDto = await _services.ProjectFromEntityToDto <User, UserDto>(a => a).ToListAsync(); Console.WriteLine($"--- {nameof(usersDto)} ---"); Console.WriteLine(JsonSerializer.Serialize(usersDto)); var userDto = await _services.ProjectFromEntityToDto <User, UserDto>(a => a.Where(b => b.Id == Guid.Parse("32feb0dd-6182-4dc0-9ad6-b147b6fb0cbb"))).FirstOrDefaultAsync(); Console.WriteLine($"--- {nameof(userDto)} ---"); Console.WriteLine(JsonSerializer.Serialize(userDto)); return(Ok()); }
public IActionResult Index() { var lista = _service.ReadManyNoTracked <PessoaDto>(); return(View(lista)); }
public async Task <ActionResult <WebApiMessageAndResult <List <TodoItemHybrid> > > > GetManyAsync([FromServices] ICrudServices service) { return(service.Response(await service.ReadManyNoTracked <TodoItemHybrid>().ToListAsync())); }
public IActionResult AllRoles([FromServices] ICrudServices <ExtraAuthorizeDbContext> services) { return(View(services.ReadManyNoTracked <RoleToPermissions>().ToList())); }