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)); }
public static void Delete(MenuDTO menu) { MenuDAL.Delete(MenuCast.ToDAL(menu)); }
public static void Update(MenuDTO menu) { MenuDAL.Update(MenuCast.ToDAL(menu)); }