public async Task <IHttpActionResult> GetAsync(int id) { var partner = await _partnerRepository.GetAsync(id); if (partner == null) { return(NotFound()); } return(Ok(partner.Map <PartnerDto>())); }
public async Task <ActionResult> Update(int id) { var partnerInDb = await _partnerRepository.GetAsync(id); if (partnerInDb == null) { return(View("List")); } var partnerVm = partnerInDb.Map <PartnerViewModel>(); partnerVm.PartnerTypeSelection = GetPartnerTypeSelection(); return(View(partnerVm)); }
public async Task <ActionResult> Create(AccountViewModel accountVm) { if (!ModelState.IsValid) { return(View(accountVm)); } var partner = await _partners.GetAsync(accountVm.SelectedPartnerId); if (partner == null) { return(View(accountVm)); } var account = new Account(accountVm.Name, accountVm.Number, partner); _accounts.Add(account); await _unitOfWork.CompleteAsync(); return(RedirectToAction("List")); }
public async Task <(IReadOnlyCollection <Partner> partners, int totalSize)> GetAsync(PartnerListRequestDto model) { return(await _partnerRepository.GetAsync(model)); }
public async Task <(IReadOnlyCollection <Partner> partners, int totalSize)> GetAsync(int page, int pageSize, string name, Vertical?vertical) { return(await _partnerRepository.GetAsync(page, pageSize, name, vertical)); }