public async Task <ActionResult <JobStateVM> > CreateJobState([FromBody] JobStateVM jobstateVM) { // Validation if (!ModelState.IsValid) { return(BadRequest(ModelState)); } // Mapping JobState jobstate = this.mapper.Map <JobStateVM, JobState>(jobstateVM); jobstate = await this.bll.CreateJobStateAsync(jobstate); // Mapping return(CreatedAtAction( "GetJobState", new { id = jobstate.Id }, this.mapper.Map <JobState, JobStateVM>(jobstate) )); }
public async Task <ActionResult <JobStateVM> > UpdateJobState([FromRoute] Guid id, [FromBody] JobStateVM jobStateVM) { // Validation if (!ModelState.IsValid || id != jobStateVM.Id) { return(BadRequest(ModelState)); } // Mapping JobState jobState = this.mapper.Map <JobStateVM, JobState>(jobStateVM); jobState = await this.bll.UpdateJobStateAsync(jobState); // Mapping return(Ok(this.mapper.Map <JobState, JobStateVM>(jobState))); }