public ActionResult CreateMarking(MarkingForCreation markingDto) { var marking = _mapper.Map <Marking>(markingDto); _dataService.CreateMarking(marking); return(CreatedAtRoute( nameof(GetMarking), new { markingId = marking.Id }, CreateMarkingDto(marking))); }
public ActionResult AddMarking([FromBody] MarkingForCreation markingDto) { var userId = Helpers.GetUserIdFromJWTToken(Request.Headers["Authorization"]); markingDto.UserId = userId; var marking = _mapper.Map <Marking>(markingDto); var result = _dataService.AddMarking(marking); if (result == false) { return(Conflict()); } return(Ok(CreateMarkingDto(marking))); }