public async Task <ActionResult <TeacherPost> > PostTeacherPost(TeacherPost teacherPost) { _context.TeacherPost.Add(teacherPost); await _context.SaveChangesAsync(); return(CreatedAtAction("GetTeacherPost", new { id = teacherPost.Id }, teacherPost)); }
public async Task <IActionResult> PutTeacherPost(Guid id, TeacherPost teacherPost) { if (id != teacherPost.Id) { return(BadRequest()); } _context.Entry(teacherPost).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TeacherPostExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }