public async Task <IActionResult> PutApprovedType(int id, ApprovedType approvedType) { //Update approved type based on the id and object provided if (id != approvedType.ApprovedTypeID) { return(BadRequest()); } _context.Entry(approvedType).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ApprovedTypeExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <ApprovedType> > PostApprovedType(ApprovedTypeDto approvedType) { //Create a new approved type based on the information provided ApprovedType newAT = new ApprovedType(); newAT.AType = approvedType.info; _context.ApprovedTypes.Add(newAT); await _context.SaveChangesAsync(); return(CreatedAtAction("GetApprovedType", new { id = newAT.ApprovedTypeID }, newAT)); }