public Budget Update(UpdateBudgetCommand command) { var budget = _repository.GetOne(command.Id); if (!string.IsNullOrEmpty(command.Proposal)) budget.ChangeProposal(command.Proposal); if (command.Price != 0) budget.ChangePrice(command.Price); if (command.Status != 0) budget.ChangeStatus(command.Status); if (command.SessionPrice != 0) budget.ChangeSessionPrice(command.SessionPrice); _repository.Update(budget); if (Commit()) return budget; return null; }
public Task<HttpResponseMessage> Put([FromBody]dynamic body) { var commandBudget = new UpdateBudgetCommand( id: Guid.Parse((string)body.id), proposal: (string)body.proposal, price: (float)body.price, status: (EBudgetStatus)body.status, proposalDate: (DateTime)body.proposalDate, sessionPrice: (float)body.sessionPrice, idCoachingProcess: (Guid)body.idCoachingProcess ); var budget = _serviceBudget.Update(commandBudget); return CreateResponse(HttpStatusCode.Created, budget); }