public async Task <IActionResult> PutHouse(long id, House house) { if (id != house.Id) { return(BadRequest()); } _context.Entry(house).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!HouseExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> GetAsync() { _context.Database.EnsureCreated(); if (_context.Houses.Any() == false) { await _context.Houses.AddRangeAsync(SeedData.Houses); } await _context.SaveChangesAsync(); return(Ok()); }