コード例 #1
0
        public async Task <IHttpActionResult> GetAsync(int id)
        {
            var partner = await _partnerRepository.GetAsync(id);

            if (partner == null)
            {
                return(NotFound());
            }

            return(Ok(partner.Map <PartnerDto>()));
        }
コード例 #2
0
        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));
        }
コード例 #3
0
        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"));
        }
コード例 #4
0
 public async Task <(IReadOnlyCollection <Partner> partners, int totalSize)> GetAsync(PartnerListRequestDto model)
 {
     return(await _partnerRepository.GetAsync(model));
 }
コード例 #5
0
 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));
 }