Ejemplo n.º 1
0
        public HttpResponseMessage AgregaConsumo(DTOPeticion <DTOHistoricoCerveza> peticion)
        {
            HttpStatusCode estado = default(HttpStatusCode);

            try
            {
                CervezaLogica.AgregarHistorico(ref estado, peticion.Entidad);
                return(HTTPResponseHelp.CrearResponse <DTORespuesta
                                                       <String> >(this, new DTORespuesta <string>()
                {
                    Mensaje = "OK"
                }, estado));
            }
            catch (Exception e)
            {
                return(HTTPResponseHelp.CrearResponse <DTORespuesta <String> >(this, new DTORespuesta <string>()
                {
                    Mensaje = "Error"
                }, HttpStatusCode.InternalServerError));
            }
        }
Ejemplo n.º 2
0
        public HttpResponseMessage Login(DTOPeticion <DTOUsuario> peticion)
        {
            string         mensaje = string.Empty;
            HttpStatusCode estado  = default(HttpStatusCode);

            try
            {
                DTOLoginRespuesta token = UsuarioLogica.Login(ref estado, ref mensaje, peticion.Entidad);

                return(HTTPResponseHelp.CrearResponse <DTORespuesta
                                                       <DTOLoginRespuesta> >(this, new DTORespuesta <DTOLoginRespuesta>()
                {
                    Mensaje = mensaje, Entidad = token
                }, estado));
            }
            catch
            {
                return(HTTPResponseHelp.CrearResponse <DTORespuesta <String> >(this, new DTORespuesta <string>()
                {
                    Mensaje = "Error"
                }, HttpStatusCode.InternalServerError));
            }
        }