public HttpResponseMessage UpdateHorario(UpdateHorarioRequest upHorario) { var HorarioDA = new HorarioDataAccess(); var HorarioUpdateado = HorarioDA.UpdateHorario(upHorario); return(Request.CreateResponse(HttpStatusCode.OK, HorarioUpdateado)); }
//METODO ACTUALIZAR HORARIO public UpdateHorarioResponse UpdateHorario(UpdateHorarioRequest upHorario) { try { using (var context = new BDReservasEntities()) { ObjectParameter RETCODE = new ObjectParameter("RETCODE", typeof(int)); ObjectParameter MENSAJE = new ObjectParameter("MENSAJE", typeof(string)); context.PA_MODIFICAR_HORARIO(upHorario.Id_horario, upHorario.Nombre, upHorario.Horario, RETCODE, MENSAJE); if ((int)RETCODE.Value < 0) { throw new Exception("Error no controlado"); } if ((int)RETCODE.Value > 0) { throw new Exception(MENSAJE.Value.ToString()); } return(new UpdateHorarioResponse() { Retcode = (int)RETCODE.Value, Mensaje = MENSAJE.Value.ToString() }); } } catch (Exception ex) { return(new UpdateHorarioResponse() { Mensaje = ex.Message }); } }