Esempio n. 1
0
        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));
        }
Esempio n. 2
0
 public PhotosController(planyourDATEContext context)
 {
     _context = context;
 }
Esempio n. 3
0
 public PlacesController(planyourDATEContext context, IMapper mapper)
 {
     _context             = context;
     _mapper              = mapper;
     this.PlaceRepository = new PlaceRepository(new planyourDATEContext());
 }
Esempio n. 4
0
 public PlaceRepository(planyourDATEContext context)
 {
     this.context = context;
 }