public async Task RegisterBusinessNullUploadImage(RegisterEditBusinessViewModel model) { byte[] imgdata = await System.IO.File.ReadAllBytesAsync(@"wwwroot\images\Default\default_logo.png"); PhotoBin logo = new PhotoBin(); logo.Content = imgdata; _repo.PhotoBin.Create(logo); _repo.Save(); // Return new photobin id to model model.Business.PhotoBinId = _repo.PhotoBin.LastPhotoAddedId(); }
public async Task CreatePetAccountNullUploadImage(PetWithImage model) { byte[] imgdata = await System.IO.File.ReadAllBytesAsync(@"wwwroot\images\Default\default_petprofile.png"); PhotoBin petprofile = new PhotoBin(); petprofile.Content = imgdata; _repo.PhotoBin.Create(petprofile); _repo.Save(); // Retrieve photoid just saved to put into service model. model.PetAccount.PhotoBinId = _repo.PhotoBin.LastPhotoAddedId(); }
public async Task CreateServiceNullUploadImage(ServiceWithPhotoUpload model) { byte[] imgdata = await System.IO.File.ReadAllBytesAsync(@"wwwroot\images\Default\default_servicethumbnail.png"); PhotoBin logo = new PhotoBin(); logo.Content = imgdata; _repo.PhotoBin.Create(logo); _repo.Save(); // Retrieve photoid just saved to put into service model. model.Service.PhotoBinId = _repo.PhotoBin.LastPhotoAddedId(); }
public ActionResult AddImage(PhotoBin image, IFormFile upload) { using (var memoryStream = new MemoryStream()) { upload.CopyToAsync(memoryStream); image.Content = memoryStream.ToArray(); string Base64 = Convert.ToBase64String(image.Content); byte[] array = Convert.FromBase64String(Base64); _context.PhotoBins.Add(image); _context.SaveChanges(); return(View()); } }
// GET: UploadController/Create public ActionResult AddImage() { PhotoBin p1 = new PhotoBin(); return(View(p1)); }
public RegisterEditBusinessViewModel() { PhotoBin = new PhotoBin(); }
public RegisterEditBusinessViewModel(Business business) { PhotoBin = new PhotoBin(); Business = business; }