Example #1
0
        public IHttpActionResult PutFormaPago(int id, FormaPago formaPago)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != formaPago.idFormaPago)
            {
                return(BadRequest());
            }
            try
            {
                FormaDePagoBLL.Update(formaPago);
                return(Content(HttpStatusCode.OK, "Forma de Pago actualizada correctamente"));
            }
            catch (Exception ex)
            {
                FormaPago forma = FormaDePagoBLL.Get(id);
                if (forma == null)
                {
                    return(NotFound());
                }
                else
                {
                    Console.WriteLine(ex);
                    return(StatusCode(HttpStatusCode.NoContent));
                }
            }
        }
Example #2
0
 public IHttpActionResult GetFormaPago(int id)
 {
     try
     {
         FormaPago result = FormaDePagoBLL.Get(id);
         if (result == null)
         {
             return(NotFound());
         }
         return(Content(HttpStatusCode.OK, result));
     }
     catch (Exception ex)
     {
         return(Content(HttpStatusCode.BadRequest, ex));
     }
 }
Example #3
0
        public IHttpActionResult DeleteFormaPago(int id)
        {
            FormaPago formaPago = FormaDePagoBLL.Get(id);

            if (formaPago == null)
            {
                return(NotFound());
            }
            try
            {
                FormaDePagoBLL.Delete(id);
                return(Ok("Forma de Pago eliminada correctamente"));
            }
            catch (Exception ex)
            {
                return(Content(HttpStatusCode.BadRequest, ex));
            }
        }