public ActionResult Get([FromQuery] PaginationModel model) { model.PageNumber = model.PageNumber == 0 ? 1 : model.PageNumber; var list = _proposalService.GetAll(x => x.Client, model.SearchTerm, model.Sort, model.PageSize * (model.PageNumber - 1), model.PageSize, x => x.Vehicle, x => x.Vehicle.Brand); var totalItems = _proposalService.Count(x => x.Client, model.SearchTerm); var totalPages = (double)totalItems / model.PageSize; var result = new { Items = list.Select(x => new { x.Id, Vehicle = x.Vehicle?.Model, x.VehicleId, Brand = x.Vehicle?.Brand?.Name, x.Client, x.Amount, x.DateProposal }), TotalPages = (int)Math.Ceiling(totalPages), TotalItems = totalItems }; return(Ok(result)); }
public async Task <IActionResult> Index(int conferenceId) { var conference = await conferenceService.GetById(conferenceId); ViewBag.Title = $"Proposals for Conference {conference.Name} {conference.Location}"; return(View(await proposalService.GetAll(conferenceId))); }
public async Task <IActionResult> Index(int conferenceId) { var conference = await _conferenceService.GetById(conferenceId); ViewBag.ConferenceId = conferenceId; ViewBag.Title = $"proposals for conference name:{conference.Name}"; return(View(await _proposalService.GetAll(conferenceId))); }
public async Task <IActionResult> Index(int conferenceId) { var conf = await mConfService.GetById(conferenceId); ViewBag.Title = $"Proposals for conference {conf.Name} {conf.Location}"; ViewBag.ConferenceId = conferenceId; return(View(await mPropService.GetAll(conferenceId))); }
public async Task <IActionResult> Index(string id) { int conferenceId = int.Parse(_dataProtector.Unprotect(id)); var conference = await conferenceService.GetById(conferenceId); ViewBag.Title = $"Proposals For Conference {conference.Name} {conference.Location}"; ViewBag.ConferenceId = id; return(View(await proposalService.GetAll(conferenceId))); }
public async Task <IActionResult> GetAll(int conferenceId) { var proposals = await _proposalService.GetAll(conferenceId); if (!proposals.Any()) { return(new NoContentResult()); } return(new ObjectResult(proposals)); }
public async Task <IActionResult> Index(string conferenceId) { var decryptedConferenceId = int.Parse(protector.Unprotect(conferenceId)); var conference = await conferenceService.GetById(decryptedConferenceId); ViewBag.Title = $"Proposals for conference {conference.Name}, {conference.Location}"; ViewBag.ConferenceId = conferenceId; return(View(await proposalService.GetAll(decryptedConferenceId))); }
public IActionResult GetList() { var result = _proposalService.GetAll(); if (result.Success) { return(Ok(result)); } return(BadRequest(result.Message)); }
public ActionResult GetById(int conferenceId) { try { return(Ok(service.GetAll(conferenceId))); } catch (Exception e) { return(NotFound(e.Message)); } }
public async Task OnGet(int conferenceId) { Proposals = await proposalService.GetAll(conferenceId); ViewData["ConferenceId"] = conferenceId; }