public HttpResponseMessage Post([FromBody] SectionViewModel section) { if (ModelState.IsValid) { if (_section.CheckSectionExits(section.SectionNo, section.CourseID)) { var responseCheck = new HttpResponseMessage() { StatusCode = HttpStatusCode.Conflict }; return(responseCheck); } int userId = Convert.ToInt32(this.User.FindFirstValue(ClaimTypes.Name)); int coorid = _coordinator.GetCoordinatorId(userId); var tempSection = AutoMapper.Mapper.Map <Section>(section); tempSection.CreatedBy = coorid; _section.InsertSection(tempSection); var response = new HttpResponseMessage() { StatusCode = HttpStatusCode.OK }; return(response); } else { var response = new HttpResponseMessage() { StatusCode = HttpStatusCode.BadRequest }; return(response); } }