Exemple #1
0
 public static void Add(MenuDTO menu)
 {
     if (menu.ImageBase64 != null)
     {
         int index = menu.ImageBase64.IndexOf(',');
         if (index > 0)
         {
             menu.ImageBase64 = menu.ImageBase64.Substring(index + 1);
         }
         var bytes = Convert.FromBase64String(menu.ImageBase64);
         using (var imageFile = new FileStream(
                    @"C:\Users\user-pc\Documents\GitHub\finalPoject\server\WEB_API\WEB_API\src\images\products\"
                    + menu.Category + @"\" + menu.image, FileMode.Create
                    ))
         {
             imageFile.Write(bytes, 0, bytes.Length);
             imageFile.Flush();
         }
     }
     MenuDAL.Add(MenuCast.ToDAL(menu));
 }
Exemple #2
0
 public static void Delete(MenuDTO menu)
 {
     MenuDAL.Delete(MenuCast.ToDAL(menu));
 }
Exemple #3
0
 public static void Update(MenuDTO menu)
 {
     MenuDAL.Update(MenuCast.ToDAL(menu));
 }