public async Task AddNewFaceAsync([FromBody] FaceRequestDTO faceRequestDTO) { var faceRequest = new FaceRequest() { RequestedFaceId = faceRequestDTO.FaceId, AuthorizationCode = faceRequestDTO.AuthorizationCode, CreationDateTime = DateTime.UtcNow }; await _requestService.AddAsync(faceRequest); }
public async Task <IActionResult> Post([FromBody] Request model) { if (!ModelState.IsValid) { return(BadRequest(ModelState.Values.SelectMany(v => v.Errors))); } model.Type = (VacationType)model.TypeId; User user = await _userService.GetUser(x => x.UserName == this.User.Identity.Name); model.UserId = user.Id; model.CreatedDate = DateTime.Now.Date; Request newRequest = await _service.AddAsync(model); _logger.LogInformation($"Request created successfully(id: {newRequest.Id}, author: {model.UserId})"); return(Ok(newRequest)); }