[RequestSizeLimit(31457280)] //30 MB for now, change it later based on the size of the pixel art's data consumption. public async Task <IActionResult> Add(PixelArt p) { IFormFile Pixel = p.PixelArtPhoto; if (FileUploadHelper.IsFileEmpty(Pixel)) { //Add Error. //return view. } if (!FileUploadHelper.IsValidExtension(Pixel, FileUploadHelper.FileTypes.Photo)) { //Add error message //return view. } string pixelArtName = await _BlobHelper.UploadBlob(p.PixelArtPhoto); p.PixelArtURL = pixelArtName; //add to DB _context.PixelArts.Add(p); //makes sure the changes are saved/executed. await _context.SaveChangesAsync(); //redirect back to Gallery Page return(RedirectToAction("Gallery")); }
public async Task <ActionResult> Add(CommissionsLog c) { _context.Commissions.Add(c); await _context.SaveChangesAsync(); return(RedirectToAction("Commissions")); }