コード例 #1
0
        // PUT api/<controller>/5
        //public void Put(int id, [FromBody]string value)
        //{
        //}

        // DELETE api/<controller>/5
        public HttpResponseMessage Delete(long id)
        {
            HttpResponseMessage response;

            try
            {
                CajaService service = (CajaService) new CajaService().setDatabase(db);
                Caja        c       = service.find(id);
                service.delete(id);

                if (c.Estado == "D")
                {
                    response = this.getSuccessResponse(c);
                }
                else
                {
                    response = this.getSuccessResponse("No se puede eliminar porque existe una compra o hay stock disponible");
                }
            }
            catch (Exception e)
            {
                response = this.getErrorResponse(e);
            }
            return(response);
        }
コード例 #2
0
        // GET api/GetCaja/5
        public HttpResponseMessage GetCaja(long id)
        {
            HttpResponseMessage response;

            try
            {
                CajaService service = (CajaService) new CajaService().setDatabase(db);
                Caja        c       = service.find(id);



                response = this.getSuccessResponse(c);
            }
            catch (Exception e)
            {
                response = this.getErrorResponse(e);
            }
            return(response);
        }