public void Save(bool inTemp = false) { if (!inTemp) { products product; bool _isExist = false; if (isExist(product_id)) { product = DataBase.entity.products.FirstOrDefault(x => x.product_id == product_id); _isExist = true; } else { product = new products(); } product.product_id = this.product_id; product.product_name = this.product_name; product.product_shordescription = this.product_shordescription; product.product_fulldescription = this.product_fulldescription; product.product_price = this.product_price; product.product_hit = this.product_hit; product.product_enabled = this.product_enabled; product.product_approved = this.product_approved; product.category_id = this.category_id; product.provider_id = this.provider_id; if (!_isExist) { DataBase.entity.products.Add(product); } DataBase.entity.SaveChanges(); } else { products_temp product; bool _isExist = false; if (isExistInTem(product_id)) { product = DataBase.entity.products_temp.FirstOrDefault(x => x.product_id == product_id); _isExist = true; } else { product = new products_temp(); } if (!_isExist) { product.product_id = this.product_id; } product.product_name = this.product_name; product.product_shordescription = this.product_shordescription; product.product_fulldescription = this.product_fulldescription; product.product_price = this.product_price; product.product_hit = this.product_hit; product.product_enabled = this.product_enabled; product.product_approved = this.product_approved; product.category_id = this.category_id; product.provider_id = this.provider_id; if (!_isExist) { DataBase.entity.products_temp.Add(product); } DataBase.entity.SaveChanges(); } }
public void Save(bool inTemp = false) { if (!inTemp) { products product; bool _isExist = false; if (isExist(product_id)) { product = DataBase.entity.products.FirstOrDefault(x => x.product_id == product_id); _isExist = true; } else { product = new products(); } product.product_id = this.product_id; product.product_name = this.product_name; product.product_shordescription = this.product_shordescription; product.product_fulldescription = this.product_fulldescription; product.product_price = this.product_price; product.product_hit = this.product_hit; product.product_enabled = this.product_enabled; product.product_approved = this.product_approved; product.category_id = this.category_id; product.provider_id = this.provider_id; if (!_isExist) DataBase.entity.products.Add(product); DataBase.entity.SaveChanges(); } else { products_temp product; bool _isExist = false; if (isExistInTem(product_id)) { product = DataBase.entity.products_temp.FirstOrDefault(x => x.product_id == product_id); _isExist = true; } else { product = new products_temp(); } if (!_isExist) product.product_id = this.product_id; product.product_name = this.product_name; product.product_shordescription = this.product_shordescription; product.product_fulldescription = this.product_fulldescription; product.product_price = this.product_price; product.product_hit = this.product_hit; product.product_enabled = this.product_enabled; product.product_approved = this.product_approved; product.category_id = this.category_id; product.provider_id = this.provider_id; if (!_isExist) DataBase.entity.products_temp.Add(product); DataBase.entity.SaveChanges(); } }