public async Task <ActionResult> Post([FromForm] StorePhotosCreationDTO storePhotosCreationDTO) { var storePhoto = mapper.Map <StorePhotos>(storePhotosCreationDTO); if (storePhotosCreationDTO.Photo != null) { storePhoto.Photo = await stockerAzureStorage.GuardarArchivo(contenedor, storePhotosCreationDTO.Photo); } context.Add(storePhoto); await context.SaveChangesAsync(); //return new CreatedAtRouteResult("GetStorePhoto", new { id = storePhoto.Id }, storePhotosCreationDTO); return(NoContent()); }
public async Task <ActionResult <Store> > Post([FromForm] StoreCreationDTO storeCreationDTO) { //string url = $"https://www.instagram.com/{storeCreationDTO.InstagramAccount}/?__a=1"; //var json = new WebClient().DownloadString(url); //dynamic api = JsonConvert.DeserializeObject(json); //bool privacidad = api.graphql.user.is_private; //if (privacidad) { return BadRequest("The account cannot be private."); } var store = mapper.Map <Store>(storeCreationDTO); //store.Photo = api.graphql.user.profile_pic_url_hd; if (storeCreationDTO.Photo != null) { store.Photo = await stockerAzureStorage.GuardarArchivo(contenedor, storeCreationDTO.Photo); } _context.Stores.Add(store); await _context.SaveChangesAsync(); var storeDTO = mapper.Map <StoreDTO>(store); return(new CreatedAtRouteResult("GetStore", new { id = storeDTO.StoreId }, storeDTO)); }