public async Task <bool> CreateReservation(Reservation reservation) { try { reservation.StartDateTime = reservation.StartDateTime.AddHours(-7); reservation = setReservation(reservation); await _context.Reservation.AddAsync(reservation); await _context.SaveChangesAsync(); return(true); } catch (Exception ex) { throw ex; } }
public async Task <IActionResult> PutScore([FromForm] int key, [FromForm] string values) { var Score = _context.Scores.FirstOrDefault(o => o.Id == key); if (Score == null) { return(StatusCode(409, "Item not found")); } JsonConvert.PopulateObject(values, Score); if (!TryValidateModel(Score)) { return(BadRequest()); } await _context.SaveChangesAsync(); return(Ok(Score)); }