public IActionResult Delete(string email) { try { bool success = _newsletterService.DeleteNewsletter(email); if (success) { return(Ok()); } return(BadRequest("Can't delete Newsletter")); } catch (Exception exc) { _logger.LogError(exc, exc.Message); return(BadRequest(exc.Message)); } }
public IActionResult RemoveNewsletter(int newsletterId) { if (User.IsInRole("ReadOnlyUser")) { return(RedirectToAction("NewsletterManager")); } try { _newsletter.DeleteNewsletter(newsletterId); } catch (Exception ex) { string error = string.Format("There was an error deleting a newsletter with the id {0}", newsletterId); _logger.LogError(error, ex); } return(RedirectToAction("NewsletterManager")); }
public async Task DeleteNewsletter(int newsletterId) { await newsletterService.DeleteNewsletter(newsletterId); }