public static bool Save(PaymentMethodModel paymentMethodObj)
        {
            sale_pointEntities db  = new sale_pointEntities();
            forma_pagamento    pgt = new forma_pagamento();

            pgt.pgt_id_forma_pagamento = paymentMethodObj.paymentMethodId;
            pgt.pgt_ds_forma_pagamento = paymentMethodObj.paymentMethodDescription;

            if (pgt.pgt_id_forma_pagamento > 0)
            {
                db.forma_pagamento.Attach(pgt);
                db.Entry(pgt).State = EntityState.Modified;
            }
            else
            {
                db.forma_pagamento.Add(pgt);
            }

            return(db.SaveChanges() > 0);
        }
Ejemplo n.º 2
0
        public static bool Save(CategoryModel categoryObj)
        {
            sale_pointEntities db  = new sale_pointEntities();
            categoria          cat = new categoria();

            cat.cat_id_categoria = categoryObj.categoryId;
            cat.cat_ds_categoria = categoryObj.categoryDescription;

            if (cat.cat_id_categoria > 0)
            {
                db.categoria.Attach(cat);
                db.Entry(cat).State = EntityState.Modified;
            }
            else
            {
                db.categoria.Add(cat);
            }

            return(db.SaveChanges() > 0);
        }
Ejemplo n.º 3
0
        public static bool Save(ProductModel productObj)
        {
            sale_pointEntities db  = new sale_pointEntities();
            produto            pro = new produto();

            pro.pro_id_produto = productObj.productId;
            pro.pro_ds_produto = productObj.productDescription;

            pro.pro_ds_preco     = double.Parse(productObj.productPrice.Replace(".", ","));
            pro.pro_id_categoria = productObj.categoryId;

            if (pro.pro_id_produto > 0)
            {
                db.produto.Attach(pro);
                db.Entry(pro).State = EntityState.Modified;
            }
            else
            {
                db.produto.Add(pro);
            }

            return(db.SaveChanges() > 0);
        }