public void InviteUsersToEvent(EventTreatmentUsersModel model) { var repo = _contextManager.CreateRepositiry <IEventRepo>(); var eventRecord = repo.GetById(model.EventId); _subscriptionService.CheckSubscription(eventRecord.CompanyId); if (eventRecord == null) { throw new ValidationException("Event not found."); } var generateEmail = new GenerateEmailDto { UrlAdress = _urlAdress + "/event/" + model.EventId + "?", EmailMainText = "Invitation to the event, for confirmation follow the link", ObjectId = model.EventId, Subject = "Welcome to the Event" }; foreach (string email in model.Email) { EmailFunctionality(email, model.EventId, generateEmail); } }
public IActionResult InviteEmail(EventTreatmentUsersModel model) { try { _service.InviteUsersToEvent(model); return(Ok("Link to join the event is sent to emails")); } catch (ValidationException ex) { return(BadRequest(ex.Message)); } }