Exemplo n.º 1
0
        public async Task <IActionResult> PutLocation([FromRoute] int id, [FromBody] Location location)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != location.ID)
            {
                return(BadRequest());
            }

            _context.Entry(location).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!LocationExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtAction("GetLocation", new { id = location.ID }, location));
        }
Exemplo n.º 2
0
        public async Task CreatePlaceReport(Report <Place> placeReport)
        {
            /*EntityEntry<Report<Place>> newlyAdded = */
            await dbContext.PlaceReports.AddAsync(placeReport);

            await dbContext.SaveChangesAsync();
        }
Exemplo n.º 3
0
        public async Task CreateReviewReport(Report <Review> reviewReport)
        {
            await dbContext.ReviewReports.AddAsync(reviewReport);

            await dbContext.SaveChangesAsync();
        }
Exemplo n.º 4
0
        public async Task CreateUserReport(Report <User> userReport)
        {
            EntityEntry <Report <User> > newlyAdded = await dbContext.UserReports.AddAsync(userReport);

            await dbContext.SaveChangesAsync();
        }