public async Task <IHttpActionResult> Post([FromBody] string[] guids, int templateId) { if (!await appManager.TemplateExists(templateId)) { return(BadRequest("Template doesn't exist")); } if (guids == null || guids.Length == 0) { return(BadRequest("No recipients were found")); } var contacts = await mailManager.GetRecipients(guids); if (contacts.Count == 0) { return(BadRequest("No recipients were found")); } await mailManager.SendMailToListOfContacts(contacts, templateId); return(Ok()); }