public ProfessorsControllerTests() { updateProfessorModel = new UpdateProfessorModel(); mockRepo = new Mock <IProfessorService>(); controller = new ProfessorController(mockRepo.Object); professorModel = Mapper.Map <UpdateProfessorModel, Professor>(updateProfessorModel); }
public async Task <IActionResult> UpdateProfessor([FromBody] UpdateProfessorModel createProfessorModel, Guid id) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var professor = await professorService.GetCourseByProfId(id); if (professor == null) { return(NotFound()); } var professorModel = Mapper.Map <UpdateProfessorModel, Professor>(createProfessorModel); await professorService.UpdateAsync(id, professorModel); return(NoContent()); }