public static bool Delete(int id)
        {
            sale_pointEntities db = new sale_pointEntities();

            db.forma_pagamento.Where(x => x.pgt_id_forma_pagamento == id).ToList().ForEach(y => db.forma_pagamento.Remove(y));
            return(db.SaveChanges() > 0);
        }
示例#2
0
        public static bool Delete(int id)
        {
            sale_pointEntities db = new sale_pointEntities();

            db.produto.Where(x => x.pro_id_produto == id).ToList().ForEach(y => db.produto.Remove(y));
            if (BuyingSessionModel.GetBuyingSession().sessionProductsListlist.Any(x => x.productId == id))
            {
                return(false);
            }
            return(db.SaveChanges() > 0);
        }
        public static bool Delete(int id)
        {
            sale_pointEntities db = new sale_pointEntities();

            db.categoria.Where(x => x.cat_id_categoria == id).ToList().ForEach(y => db.categoria.Remove(y));
            try
            {
                return(db.SaveChanges() > 0);
            }
            catch (Exception)
            {
                return(false);
            }
        }
        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);
        }
        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);
        }
示例#6
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);
        }