Example #1
0
        public Budget Create(CreateBudgetCommand command)
        {
            var service = new Budget(command.Proposal, command.Price, command.ProposalDate, command.Status, command.SessionPrice, command.IdCoachingProcess);

            service.Validate();
            _repository.Create(service);

            if (Commit())
            {
                return(service);
            }

            return(null);
        }
Example #2
0
        public async Task <IActionResult> PostBudget(BudgetForCreateDto budget)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var billsToAttach = _billRepository.GetBillsFromNameList(budget.ReturnedBillNames);

            var budgetToCreate = Mapper.Map <Budget>(budget);

            budgetToCreate.Bills = billsToAttach;

            await _budgetRepository.Create(budgetToCreate);

            return(CreatedAtAction("GetBudget", new { id = budget.Id }, budget));
        }
Example #3
0
 public Budget Create(Budget budget)
 {
     return(budgetRepository.Create(budget));
 }