Пример #1
0
        //פונקצית הוספת בגד לרשימה
        public static List <clothesEntity> AddClothing(clothesEntity c)
        {
            int    n        = c.img.LastIndexOf(@"\");
            string img_file = c.img.Substring(n + 1);

            //if (!System.IO.File.Exists(@"D:\Ayala\web\Angular\Final_project\ClothesWebSite\ClothesWebSite\Images\" + img_file))
            //System.IO.File.Copy(img_file, @"D:\Ayala\web\Angular\Final_project\ClothesWebSite\ClothesWebSite\Images");
            c.img = img_file;
            connectDB.entity.clothesTBL.Add(clothesEntity.ConvertEntityToDB(c));
            connectDB.entity.SaveChanges();
            return(clothesEntity.ConvertListDBToListEntity(connectDB.entity.clothesTBL.ToList()));
        }
Пример #2
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()));
        }
Пример #3
0
 public List <clothesEntity> EditClothing([FromBody] clothesEntity c)
 {
     return(ClothesBL.EditClothing(c));
 }