public async Task <string> ShareVideoLink(int userId, CreateVideoLinkVm model) { if (!await _videoRepository.IsUserVideoOwner(userId, model.VideoId)) { throw new AccessDeniedException(); } return(await _linkRepository.GetLink(userId, model.VideoId, model.LinkPassword, model.ExpiryDate) ?? await _linkRepository.CreateVideoLink(userId, _mapper.Map <CreateVideoLinkDto>(model))); }
public async Task <IActionResult> ShareVideoLink([FromBody] CreateVideoLinkVm model) { return(this.Ok(await _videoService.ShareVideoLink(this.CurrentUserId.Value, model))); }