public static Agenda ToDomainModel(AgendaCommand agendaCommand) { var agenda = new Agenda( agendaCommand.DataInicioDoAgendamento, agendaCommand.ClienteId, agendaCommand.FuncionarioId, agendaCommand.TipoDeServicoId, agendaCommand.EstabelecimentoId, agendaCommand.IdAgenda); return(agenda); }
public Task <HttpResponseMessage> Post([FromBody] dynamic body) { var agendaCommand = new AgendaCommand( dataInicioDoAgendamento: (DateTime)body.startsAt, idCliente: (Guid)body.clienteId, idFuncionario: (Guid)body.funcionarioId, idTipoDeServico: (Guid)body.tipoDeServicoId, idEstabelecimento: (Guid)body.estabelecimentoId ); var agenda = _agendaApp.Cadastrar(agendaCommand); return(CreateResponse(HttpStatusCode.Created, agenda)); }
public AgendaCommand Cadastrar(AgendaCommand agendaCommand) { if (agendaCommand.TipoDeServicoId == null) { return(null); } var tipoDeServico = _tipoDeServicoService.ObterPorId(agendaCommand.TipoDeServicoId.Value); var agenda = AgendaAdapter.ToDomainModel(agendaCommand); agenda.CalcularDataFimAgendamentoPeloTipoDeServico(tipoDeServico.TempoGastoEmMinutos); var agendaRetorno = _agendaService.Adicionar(agenda); if (Commit()) { return(AgendaAdapter.ToModelDomain(_agendaService.ObterPorId(agendaRetorno.IdAgenda))); } return(null); }
public static AgendaCommand ToModelDomain(Agenda agenda) { if (agenda == null) { return(null); } var agendaCommand = new AgendaCommand( agenda.DataInicioDoAgendamento, agenda.ClienteId, agenda.FuncionarioId, agenda.TipoDeServicoId, agenda.EstabelecimentoId); agendaCommand.IdAgenda = agenda.IdAgenda; agendaCommand.Status = agenda.Status; agendaCommand.DataFimDoAgendamento = agenda.DataFimDoAgendamento; agendaCommand.Cliente = ClienteAdapter.ToModelDomain(agenda.Cliente); agendaCommand.Funcionario = FuncionarioAdapter.ToModelDomain(agenda.Funcionario); return(agendaCommand); }
public AgendaCommand Atualizar(AgendaCommand agendaCommand) { throw new NotImplementedException(); }