public ActionResult Cadastrar(AgendamentoDto model)
        {
            var value = Request.Cookies[FormsAuthentication.FormsCookieName].Value;

            model.HorarioInicial = DateTime.Parse(model.DiaInicial + " " + model.HoraInicial);
            model.HorarioFinal   = DateTime.Parse(model.DiaFinal + " " + model.HoraFinal);


            var agendamento = _serviceAgendamento.Cadastrar(value, model);

            return(RedirectToAction("Index"));
        }
Beispiel #2
0
 public IHttpActionResult Cadastrar(AgendamentoDto agendamentoDto)
 {
     try
     {
         serviceAgendamento.Cadastrar(agendamentoDto);
         return(Ok());
     }
     catch (ObjectNotFoundException e)
     {
         return(ResponseMessage(Request.CreateResponse(HttpStatusCode.NotFound, e.Message)));
     }
     catch (Exception e)
     {
         return(BadRequest(e.Message));
     }
 }