public bool deleteList(List List) { using (EmarketEntities mdeEmarket = new EmarketEntities()) { try { int idList = Convert.ToInt32(List.idList); ListEntity list = mdeEmarket.ListEntities.Single(p => p.idList == idList); mdeEmarket.ListEntities.Remove(list); mdeEmarket.SaveChanges(); return(true); } catch { return(false); } } }
/***********************************************************************************************/ /**************************************** LIST *************************************************/ public bool createList(List List) { using (EmarketEntities mdeEmarket = new EmarketEntities()) { try { int idList = Convert.ToInt32(List.idList); int idUser = Convert.ToInt32(List.idUser); ListEntity list = new ListEntity(); list.idList = idList; list.idUser = idUser; list.Name = List.Name; list.idProductName = List.idProductName; mdeEmarket.ListEntities.Add(list); mdeEmarket.SaveChanges(); return(true); } catch { return(false); } } }