public async Task <ActionResult <WeeksType> > PostWeeksType(WeeksType weeksType) { _context.WeeksTypes.Add(weeksType); await _context.SaveChangesAsync(); return(CreatedAtAction("GetWeeksType", new { id = weeksType.Id }, weeksType)); }
public async Task <IActionResult> PutWeeksType(int id, WeeksType weeksType) { if (id != weeksType.Id) { return(BadRequest()); } _context.Entry(weeksType).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!WeeksTypeExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }