public async Task <ActionResult <DailyReadingDTO> > PostDailyReadingDTO(DailyReadingDTO dailyReadingDTO) { _context.DailyReadings.Add(dailyReadingDTO); await _context.SaveChangesAsync(); return(CreatedAtAction("GetDailyReadingDTO", new { id = dailyReadingDTO.Id }, dailyReadingDTO)); }
public async Task <IActionResult> PutDailyReadingDTO(int id, DailyReadingDTO dailyReadingDTO) { if (id != dailyReadingDTO.Id) { return(BadRequest()); } _context.Entry(dailyReadingDTO).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DailyReadingDTOExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }