public IHttpActionResult AddSubject(SubjectDto subjectDto) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } subjectRepo.Insert(Mapper.Map <Subject>(subjectDto)); return(CreatedAtRoute("AddSubject", new { id = subjectDto.SubjectId }, subjectDto)); }