コード例 #1
0
 //המרת בגד בודד מסוג המסד לסוג המחלקה
 public static clothesEntity ConvertDBToEntity(clothesTBL c)
 {
     return(new clothesEntity()
     {
         id = c.id, name = c.name, category_id = c.category_id, price = c.price, img = c.img, color = c.color, size = c.size, amount = c.amount, category_name = c.categoryTBL.name
     });
 }
コード例 #2
0
        //פונקצית הסרת בגד מהרשימה
        public static List <clothesEntity> DeleteClothing(int id)
        {
            clothesTBL c = connectDB.entity.clothesTBL.FirstOrDefault(x => x.id == id);

            if (c.shopingDetailsTBL.Count() == 0 && c.shopingDetailsTBL.Select(x => x.shopingsTBL).Count() == 0)
            {
                connectDB.entity.clothesTBL.Remove(c);
            }
            connectDB.entity.SaveChanges();
            return(clothesEntity.ConvertListDBToListEntity(connectDB.entity.clothesTBL.ToList()));
        }
コード例 #3
0
        //פונקצית עדכון בגד מהרשימה
        public static List <clothesEntity> EditClothing(clothesEntity c)
        {
            clothesTBL cloth = connectDB.entity.clothesTBL.First(x => x.id == c.id);

            cloth.img         = c.img;
            cloth.color       = c.color;
            cloth.name        = c.name;
            cloth.price       = c.price;
            cloth.size        = c.size;
            cloth.category_id = c.category_id;
            cloth.amount      = c.amount;
            connectDB.entity.SaveChanges();
            return(clothesEntity.ConvertListDBToListEntity(connectDB.entity.clothesTBL.ToList()));
        }