// POST: api/Promo
        public HttpResponseMessage Post([FromBody] Models.Promocion value)
        {
            int res = 0;
            HttpResponseMessage msj = null;

            try
            {
                using (PromocionEntities db = new PromocionEntities())
                {
                    db.Entry(value).State = EntityState.Added;
                    res = db.SaveChanges();
                    msj = Request.CreateResponse(HttpStatusCode.OK, res);
                }
            }
            catch (Exception ex)
            {
                msj = Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message);
            }
            return(msj);
        }
Пример #2
0
 public IndexPromocion()
 {
     this.InitializeComponent();
     GastroCloud.Models.Promocion promocion = new Models.Promocion();
     gridPromociones.ItemsSource = promocion.getDescuento();
 }