示例#1
0
        public IHttpActionResult Get()
        {
            apiResp = new ApiResponse();
            var mng = new IdiomasManager();

            apiResp.Data = mng.RetrieveAll();

            return(Ok(apiResp));
        }
示例#2
0
        public IHttpActionResult Post(Idiomas idioma)
        {
            try
            {
                var    mng      = new IdiomasManager();
                String response = mng.Create(idioma);

                apiResp         = new ApiResponse();
                apiResp.Message = "Action was executed.";

                return(Ok(apiResp));
            }
            catch (BusinessException bex)
            {
                return(Content(HttpStatusCode.BadRequest, bex));
            }
        }
示例#3
0
        public IHttpActionResult GetByName(string nombre_idioma)
        {
            try
            {
                var mng    = new IdiomasManager();
                var idioma = new Idiomas
                {
                    NOMBRE_IDIOMA = nombre_idioma
                };

                idioma       = mng.RetrieveByName(idioma);
                apiResp      = new ApiResponse();
                apiResp.Data = idioma;
                return(Ok(apiResp));
            }
            catch (BusinessException bex)
            {
                return(InternalServerError(new Exception(bex.ExceptionId + "-" + bex.AppMessage.MESSAGE)));
            }
        }