public async Task <IActionResult> PutUsersPosts([FromRoute] int id, [FromBody] UsersPosts usersPosts) { //Console.WriteLine(usersPosts.postTitle); //Console.WriteLine(id); if (id != usersPosts.postID) { return(BadRequest()); } _context.Entry(usersPosts).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!UsersPostsExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutUsers(string id, Users users) { if (id != users.Email) { return(BadRequest()); } _context.Entry(users).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!UsersExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutHotelManager(int id, HotelManager hotelManager) { if (id != hotelManager.id) { return(BadRequest()); } _context.Entry(hotelManager).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!HotelManagerExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutCars(int id, Cars cars) { if (id != cars.Id) { return(BadRequest()); } _context.Entry(cars).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CarsExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }