public async Task <ActionResult> Create(PartnerViewModel partnerVm)
        {
            if (!ModelState.IsValid)
            {
                return(View(partnerVm));
            }

            _partners.Add(partnerVm.Map <Partner>());

            await _unitOfWork.CompleteAsync();

            return(View("List"));
        }
        public async Task <IHttpActionResult> UpdateAsync(int id, ExchangeRateDto exchangeRate)
        {
            var exchangeRateInDb = await _repository.GetAsync(id);

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

            _repository.Add(exchangeRate.Map <ExchangeRate>());
            await _unitOfWork.CompleteAsync();

            return(Ok());
        }
Пример #3
0
        public async Task <IHttpActionResult> UpdateAsync(int id, CurrencyDto currency)
        {
            var currencyInDb = await _repository.GetAsync(id);

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

            _repository.Add(currency.Map <Currency>());
            await _unitOfWork.CompleteAsync();

            return(Ok());
        }
Пример #4
0
        public async Task <IHttpActionResult> UpdateAsync(int id, InstitutionDto institution)
        {
            var institutionInDb = await _repository.GetAsync(id);

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

            _repository.Add(institution.Map <Institution>());

            await _unitOfWork.CompleteAsync();

            return(Ok());
        }
        public async Task <IHttpActionResult> UpdateAsync(int id, PortfolioDto portfolio)
        {
            var portfolioInDb = await _repository.GetAsync(id);

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

            _repository.Add(portfolio.Map <Portfolio>());

            await _unitOfWork.CompleteAsync();

            return(Ok());
        }
        public async Task <IHttpActionResult> UpdateAsync(int id, AccountDto account)
        {
            var accountInDb = await _repository.GetAsync(id);

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

            _repository.Add(account.Map <Account>());

            await _unitOfWork.CompleteAsync();

            return(Ok());
        }
        public async Task <IHttpActionResult> UpdateAsync(int id, ServerTaskDto task)
        {
            var taskInDb = await _repository.GetAsync(id);

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

            _repository.Add(task.Map <ServerTask>());

            await _unitOfWork.CompleteAsync();

            return(Ok());
        }
Пример #8
0
        public async Task <ActionResult> Create(ContactViewModel contactVm)
        {
            if (!ModelState.IsValid)
            {
                contactVm.PartnerNumberSelection = await GetPartnerSelection();

                return(View(contactVm));
            }

            _contacts.Add(contactVm.Map <Contact>());

            await _unitOfWork.CompleteAsync();

            return(RedirectToAction("List"));
        }
Пример #9
0
        public async Task <IHttpActionResult> UpdateAsync(int id, ContactDto contact)
        {
            var contactInDb = await _repository.GetAsync(id);

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

            _repository.Add(contact.Map <Contact>());

            await _unitOfWork.CompleteAsync();

            return(Ok());
        }
        public async Task <IHttpActionResult> UpdateAsync(int id, PartnerDto partner)
        {
            var partnerInDb = await _partnersRepository.GetAsync(id);

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

            _partnersRepository.Add(partner.Map <Partner>());

            await _unitOfWork.CompleteAsync();

            return(Ok());
        }
        public async Task <IHttpActionResult> UpdateAsync(int id, ReportDto report)
        {
            var reportInDb = await _repository.GetAsync(id);

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

            _repository.Add(report.Map <Report>());

            await _unitOfWork.CompleteAsync();

            return(Ok());
        }
Пример #12
0
        public async Task <IHttpActionResult> CreateAsync(CreateWidgetDto createWidgetDto)
        {
            var newWidget = TileWidget.Build(CurrentUser.Id, createWidgetDto.Name, createWidgetDto.Name, createWidgetDto.Url);

            _repository.Add(newWidget);

            await _unitOfWork.CompleteAsync();

            return(Created(new Uri(Request.RequestUri + "/" + newWidget.Id), newWidget));
        }
Пример #13
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"));
        }
        public async Task <ActionResult> Create(NewPortfolioViewModel portfolioVm)
        {
            if (!ModelState.IsValid)
            {
                return(View(portfolioVm));
            }

            _portfolios.Add(portfolioVm.Map <Portfolio>());

            await _unitOfWork.CompleteAsync();

            return(View("List"));
        }