public static void SaveCustomers(Customer Obj_Customer_Save)//This is Add method. { try { using (WineShopEntities db = new WineShopEntities()) { db.Customers.Add(Obj_Customer_Save); db.SaveChanges(); } } catch (Exception ex) { throw ex; } }
public static void AddWines(Wine wine)//This is Add method. { try { using (WineShopEntities db = new WineShopEntities()) { db.Wines.Add(wine); db.SaveChanges(); } } catch (Exception ex) { throw ex; } }
public static void AddRateLists(RateList rateList)//Add method. { try { using (WineShopEntities db = new WineShopEntities()) { db.RateLists.Add(rateList); db.SaveChanges(); } } catch (Exception ex) { throw ex; } }
public static void AddCustomers(Customer customer)//Add method. { try { using (WineShopEntities db = new WineShopEntities()) { db.Customers.Add(customer); db.SaveChanges(); } } catch (Exception ex) { throw ex; } }
public static void SaveRateLists(RateList Obj_RateList_Save)//This is Add method. { try { using (WineShopEntities db = new WineShopEntities()) { db.RateLists.Add(Obj_RateList_Save); db.SaveChanges(); } } catch (Exception ex) { throw ex; } }
public static List <Wine> GetWineDetails(string wineID) { try { List <Wine> wine = null; using (WineShopEntities db = new WineShopEntities()) { wine = (from w in db.Wines where w.ID.ToString() == wineID select w).ToList(); } return(wine); } catch (Exception ex) { throw ex; } }
public static List <Wine> GetWineDetails(string selectedValue) { try { List <Wine> Obj_Wine_Detail = null; using (WineShopEntities db = new WineShopEntities()) { Obj_Wine_Detail = (from c in db.Wines where c.ID.ToString() == selectedValue select c).ToList(); } return(Obj_Wine_Detail); } catch (Exception ex) { throw ex; } }
public static List <RateList> GetRateListDetails(string rateListID) { try { List <RateList> rateList = null; using (WineShopEntities db = new WineShopEntities()) { rateList = (from c in db.RateLists where c.ID.ToString() == rateListID select c).ToList(); } return(rateList ); } catch (Exception ex) { throw ex; } }
public static List <Customer> CustomerDetails(string customerID) { try { List <Customer> customer = null; using (WineShopEntities db = new WineShopEntities()) { customer = (from c in db.Customers where c.ID.ToString() == customerID select c).ToList(); } return(customer ); } catch (Exception ex) { throw ex; } }
public static int UpdateRateList(RateList rateList) { try { using (WineShopEntities db = new WineShopEntities()) { //Lambda expression RateList r = db.RateLists.SingleOrDefault(x => x.ID == rateList.ID); r.Price = rateList.Price; db.SaveChanges(); return(rateList.ID); } } catch (Exception ex) { throw ex; } }
public static int UpdateWine(Wine Obj_Wine_Update) { try { using (WineShopEntities db = new WineShopEntities()) { //Lambda expression Wine c = db.Wines.SingleOrDefault(x => x.ID == Obj_Wine_Update.ID); c.Name = Obj_Wine_Update.Name; db.SaveChanges(); return(Obj_Wine_Update.ID); } } catch (Exception ex) { throw ex; } }
public static void DeleteWine(string wineID) { try { using (WineShopEntities db = new WineShopEntities()) { //Lambda expression Wine w = db.Wines.SingleOrDefault(x => x.ID.ToString().Trim() == wineID.Trim()); if (w != null) { db.Wines.Remove(w); db.SaveChanges(); } } } catch (Exception ex) { throw ex; } }
public static void DeleteRateList(string rateListID) { try { using (WineShopEntities db = new WineShopEntities()) { //Lambda expression RateList r = db.RateLists.SingleOrDefault(x => x.ID.ToString().Trim() == rateListID.Trim()); if (r != null) { db.RateLists.Remove(r); db.SaveChanges(); } } } catch (Exception ex) { throw ex; } }
public static void DeleteCustomer(string Obj_Customer_Delete) { try { using (WineShopEntities db = new WineShopEntities()) { //Lambda expression Customer c = db.Customers.SingleOrDefault(x => x.ID.ToString().Trim() == Obj_Customer_Delete.Trim()); if (c != null) { db.Customers.Remove(c); db.SaveChanges(); } } } catch (Exception ex) { throw ex; } }
public static int UpdateCustomer(Customer Obj_Customer_Update) { try { using (WineShopEntities db = new WineShopEntities()) { //Lambda expression Customer c = db.Customers.SingleOrDefault(x => x.ID == Obj_Customer_Update.ID); c.Name = Obj_Customer_Update.Name; c.Age = Obj_Customer_Update.Age; c.Email = Obj_Customer_Update.Email; c.RateListID = Obj_Customer_Update.RateListID; c.WineID = Obj_Customer_Update.WineID; db.SaveChanges(); return(Obj_Customer_Update.ID); } } catch (Exception ex) { throw ex; } }