Esempio n. 1
0
        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);
                }
            }
        }
Esempio n. 2
0
        /***********************************************************************************************/

        /**************************************** 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);
                }
            }
        }