private string EmailChanger(string emailAddress, string type) { string[] oldEmails = { "*****@*****.**", "*****@*****.**", "*****@*****.**", "*****@*****.**" }; string newEmail = string.Empty; if (emailAddress != null) { if (oldEmails.Any(oldEmail => oldEmail.Equals(emailAddress))) { newEmail = "*****@*****.**"; if (!string.IsNullOrEmpty(type)) { CommentCgm oldLink = new CommentCgm(); oldLink.Author = "*****@*****.**"; oldLink.Created = DateTime.Now.ToString("yyyy-MM-ddThh:mm:ss+0000"); oldLink.Body = $"Original {type} {emailAddress}"; CommentsBody.Add(oldLink); } } else { newEmail = emailAddress.Replace("@studiofarma.it", "@cgm.com"); } } return newEmail; }
public async Task <IActionResult> AddCommentsToBookCopy(string bookId, string barCode, [FromBody] CommentsBody body) { var book = await bookService.AddCommentToBookCopyAsync(bookId, barCode, body.Comments); if (book == null) { return(NotFound()); } return(Ok(new { Data = book })); }