Beispiel #1
0
        public IHttpActionResult GetProyectosUsuario(string identificacion)
        {
            apiResp = new ApiResponse();
            var mng = new ProyectoManager();

            apiResp.Data = mng.RetrieveAllProyectosUsuario(identificacion);

            return(Ok(apiResp));
        }
Beispiel #2
0
        //// GET api/proyecto
        public IHttpActionResult Get()
        {
            apiResp = new ApiResponse();
            var mng = new ProyectoManager();

            apiResp.Data = mng.RetrieveAll();

            return(Ok(apiResp));
        }
Beispiel #3
0
        // PUT
        public IHttpActionResult Put(Proyecto proyecto)
        {
            try
            {
                var mng = new ProyectoManager();
                mng.Update(proyecto);

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

                return(Ok(apiResp));
            }
            catch (BusinessException bex)
            {
                return(InternalServerError(new Exception(bex.ExceptionId + "-" + bex.AppMessage.Message)));
            }
        }
Beispiel #4
0
        // POST
        public IHttpActionResult Post(Proyecto proyecto)
        {
            try
            {
                var    mng      = new ProyectoManager();
                String response = mng.Create(proyecto);

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

                return(Ok(apiResp));
            }
            catch (BusinessException bex)
            {
                return(Content(HttpStatusCode.BadRequest, bex));
            }
        }
Beispiel #5
0
        public IHttpActionResult Get(string idUsuario, string nombre)
        {
            try
            {
                var mng      = new ProyectoManager();
                var proyecto = new Proyecto
                {
                    IdUsuario = idUsuario,
                    Nombre    = nombre
                };

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