public async Task <ActionResult <Place> > PostPlace([FromBody] IDGEN id) { Place place; String PlaceIde; try { // Constructing the video object from our helper function PlaceIde = id.PlaceIDE; place = Map.GetPlaceFromId(PlaceIde); } catch { return(BadRequest("Invalid PlaceID")); } _context.Place.Add(place); await _context.SaveChangesAsync(); int ide = place.PlaceId; planyourDATEContext a = new planyourDATEContext(); PhotosController pcc = new PhotosController(a); Task addPhoto = Task.Run(async() => { List <Photo> placearray = new List <Photo>(); placearray = Map.GetPhotosFromID(PlaceIde); for (int i = 0; i < placearray.Count; i++) { Photo pl = placearray.ElementAt(i); pl.PlaceId = ide; await pcc.PostPhoto(pl); } }); return(CreatedAtAction("GetPlace", new { id = place.PlaceId }, place)); }
public PhotosController(planyourDATEContext context) { _context = context; }
public PlacesController(planyourDATEContext context, IMapper mapper) { _context = context; _mapper = mapper; this.PlaceRepository = new PlaceRepository(new planyourDATEContext()); }
public PlaceRepository(planyourDATEContext context) { this.context = context; }