public async Task <ActionResult <SharingResultViewModel> > ShareToEmail([FromBody] SharingViewModel model) { if (string.IsNullOrEmpty(model.Id) || string.IsNullOrEmpty(model.Email)) { return(BadRequest()); } try { var entry = await _entryRepository.GetAsync(_applicationUser.Id, model.Id); if (entry is null) { return(NotFound()); } var link = await _entryRepository.CreateNewSharingLink(model); if (link != null) { await _unitOfWork.CompleteAsync(); var url = Flurl.Url.Combine(new string[] { _sharingSettings.BaseUrl, link.LinkId }); await this._mailSender.SendEmailAsync( model.Email, $"{_applicationUser.GetBestGuessName()} shared a link with you", new MailDropin { username = model.Email.Split('@')[0], //bite me! message = $"<p>{_applicationUser.GetBestGuessName()} wants to share an audio file with you!</p><br />" + $"<p>{model.Message}</p>", buttonmessage = "Let me at it!!", buttonaction = url }); return(Ok()); } } catch (Exception e) { _logger.LogError(e.Message); } return(StatusCode(500)); }