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); }
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)); }
public Budget Create(Budget budget) { return(budgetRepository.Create(budget)); }