public async Task <ActionResult <DCanditate> > PostCanditate(DCanditate dCanditate) { _context.DCanditates.Add(dCanditate); await _context.SaveChangesAsync(); return(CreatedAtAction(nameof(GetCanditates), new { Id = dCanditate.Id }, dCanditate)); }
public async Task <ActionResult> PutDCanditate(int id, DCanditate dCanditate) { dCanditate.Id = id; _context.Entry(dCanditate).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DCanditateExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }