Пример #1
0
        // --- PRIVATE METHODS ------------------------------------------------------------------ //

        private void UpdateInvitation(int status)
        {
            if (dataGridViewInvitation.RowCount > 0 &&
                dataGridViewInvitation.CurrentRow.Index > -1)
            {
                var userId   = currentUser.Keys.FirstOrDefault();
                var userName = currentUser.Values.FirstOrDefault();

                var userModel = new UserModel()
                {
                    Id   = userId,
                    Name = userName,
                };

                var invitationModel = new InvitationModel()
                {
                    Id         = Convert.ToInt32(dataGridViewInvitation.CurrentRow.Cells[0].Value),
                    UserId     = Convert.ToInt32(dataGridViewInvitation.CurrentRow.Cells[1].Value),
                    Invitation = Convert.ToInt32(dataGridViewInvitation.CurrentRow.Cells[2].Value),
                    Date       = Convert.ToDateTime(dataGridViewInvitation.CurrentRow.Cells[3].Value),
                    GuestId    = Convert.ToInt32(dataGridViewInvitation.CurrentRow.Cells[4].Value),
                    Status     = status,
                };

                OnUpdateInvitation?.Invoke(invitationModel, userModel);
            }
        }
Пример #2
0
        public async Task RejectEventRequest(InvitationModel model)
        {
            var user = await this._userManager.FindByNameAsync(model.Username);

            var query = await(from p in this._dbContext.EventParticipants
                              where model.EventId == p.EventId && p.UserId == user.Id
                              select p).FirstOrDefaultAsync();

            if (query != null)
            {
                var eventRequest =
                    await(from p in this._dbContext.EventParticipants
                          where p.EventId == query.EventId && p.UserId == query.UserId
                          select p).FirstOrDefaultAsync();

                if (eventRequest != null)
                {
                    try
                    {
                        this._dbContext.EventParticipants.Remove(eventRequest);
                        await this._dbContext.SaveChangesAsync();
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.Message);
                    }
                }
            }
        }
 public ActionResult NewAccount(InvitationModel model)
 {
     //Clear ModelState errors so the ValidationSummary doesn't display "errors" when the form is initially displaying. It should only show when the form is submitted.
     ModelState.Clear();
     //The first time we come into the NewAccount action, we need to specify a Create method
     if (model.ATSMethod == ATS.Methods.NotInitialized)
     {
         model.ATSMethod = ATS.Methods.CreateContact;
     }
     //Replace punctuation in name fields (such as a middle initial) since it is not allowed as input
     ReplacePunctuation(ref model);
     if (model.CloneAccount)
     {
         ViewBag.Title = "Create New Username";
         string memberTypeDesc = InvitationRepository.GetMemberTypeDesc(model.MemberType);
         ViewBag.Subtitle = "We found your " + memberTypeDesc + " account but we must create a new Employee account with a different web username. " +
                            "Please choose a username that is not the same as:";
         ViewBag.HighlightText        = model.Username;
         model.DoNotDuplicateUsername = model.Username;
         //Clear out the username since the user can't duplicate it with the new EMP account
         model.Username = String.Empty;
     }
     else
     {
         ViewBag.Title         = "Create a New Account";
         ViewBag.Subtitle      = "Associated with";
         ViewBag.HighlightText = model.InstituteName;
     }
     return(View(model));
 }
Пример #4
0
        private List <InvitationModel> GetInvitationModels(IEnumerable <Invitation> invitations)
        {
            if (invitations == null)
            {
                return(null);
            }

            var invitationModels = new List <InvitationModel>();

            for (int i = 0; i < invitations.Count(); i++)
            {
                var inv = invitations.ElementAt(i);

                var invitationId = inv.Id;
                var invitee      = GetUserModel(inv.InviteeId);
                var inviter      = GetUserModel(inv.InviterId);
                var eventModel   = GetEventModel(inv.EventId);
                var message      = inv.Message;

                InvitationModel model = new InvitationModel
                {
                    Id      = invitationId,
                    Invitee = invitee,
                    Inviter = inviter,
                    Event   = eventModel,
                    Message = message
                };

                invitationModels.Add(model);
            }

            return(invitationModels);
        }
Пример #5
0
        private void UserPageUI_OnDeleteEvent(IEventModel eventModel, IUserModel userModel)
        {
            var userId          = userModel.Id;
            var invitation      = eventModel.Invitation;
            var invitationTable = service.GetInvitationsByCode(invitation);

            if (service.DeleteEvent(eventModel))
            {
                foreach (DataRow row in invitationTable.Rows)
                {
                    var id  = Convert.ToInt32(row[0].ToString());
                    var gID = Convert.ToInt32(row[4].ToString());

                    var invitationModel = new InvitationModel()
                    {
                        Id         = id,
                        UserId     = userId,
                        Invitation = invitation,
                        Date       = eventModel.Date,
                        GuestId    = gID
                    };

                    service.DeleteInvitation(invitationModel);
                }
            }

            UpdateTables(userId);
        }
Пример #6
0
        private void UserPageUI_OnCreateEvent(IEventModel eventModel, IUserModel userModel)
        {
            var userId     = userModel.Id;
            var eventList  = service.GetEvents(userId);
            var invitation = 10000 * userId + eventList.Rows.Count;
            var date       = eventModel.Date;

            eventModel.Invitation = invitation;

            if (service.GetEventsByDate(eventModel.Date).Rows.Count > 0)
            {
                MessageBox.Show("There is already an event on this day!");
            }
            else
            {
                if (service.CreateEvent(eventModel))
                {
                    foreach (var guest in eventModel.Guests)
                    {
                        var invitationModel = new InvitationModel()
                        {
                            UserId     = userId,
                            Invitation = invitation,
                            Date       = date,
                            GuestId    = guest
                        };

                        service.CreateInvitation(invitationModel);
                    }

                    UpdateTables(userId);
                }
            }
        }
Пример #7
0
 public async Task <JsonResult> AddStaff(int id)
 {
     using (var db = new DBContext())
     {
         try
         {
             InvitationModel invitation = new InvitationModel();
             invitation.OrgID      = int.Parse(Session["orgid"].ToString());
             invitation.CreateTime = DateTime.Now;
             invitation.Status     = 0;
             invitation.UserID     = id;
             var staff = await(from s in db.Staff
                               where s.OrgID == invitation.OrgID && s.UserID == invitation.UserID
                               select s).FirstOrDefaultAsync();
             if (staff != null)
             {
                 return(Json("StfInOrg"));
             }
             var inv = await(from i in db.Invitation
                             where i.UserID == invitation.UserID && i.OrgID == i.OrgID && i.Status == 0
                             select i).FirstOrDefaultAsync();
             if (inv != null)
             {
                 return(Json("InvExst"));
             }
             db.Invitation.Add(invitation);
             await db.SaveChangesAsync();
         }
         catch (Exception e) { return(Json(e)); }
         return(Json("Success"));
     }
 }
        /// <summary>
        /// Invites B2B User
        /// </summary>
        /// <param name="userDisplayName"></param>
        /// <param name="emailAddress"></param>
        /// <param name="redirectUrl"></param>
        /// <returns></returns>
        private async Task <string> InviteUser(string userDisplayName, string emailAddress, string redirectUrl)
        {
            AuthenticationResult authenticationResult = await _authenticationHelper.GetGraphAuthenticationResult();

            InvitationModel invite = new InvitationModel();

            invite.invitedUserDisplayName = userDisplayName;

            invite.invitedUserEmailAddress = emailAddress;

            invite.inviteRedirectUrl = redirectUrl;

            invite.sendInvitationMessage = true;

            using (HttpClient client = new HttpClient())
            {
                client.BaseAddress = new Uri($"{ApplicationConstants.BASE_URL.MICROSOFT_GRAPH}");

                client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

                client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", authenticationResult.AccessToken);

                HttpResponseMessage response = await client.PostAsync("v1.0/invitations", new StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(invite)));

                string inviteResultString = await response.Content.ReadAsStringAsync();

                InvitationModel inviteResult = Newtonsoft.Json.JsonConvert.DeserializeObject <InvitationModel>(inviteResultString);

                return(inviteResult.invitedUser.id);
            }
        }
Пример #9
0
        public ActionResult InviteToJoin()
        {
            var             user   = db.Users.Find(User.Identity.GetUserId());
            InvitationModel invite = new InvitationModel();

            invite.HouseholdId = (int)user.HouseholdId;
            return(View(invite));
        }
        public async Task CreateInvitation(InvitationModel model)
        {
            var invitation = _mapper.Map <Invitation>(model);

            await _dbContext.Invitations.AddAsync(invitation);

            await _dbContext.SaveChangesAsync();
        }
        public ActionResult InvitationForm(InvitationModel model)
        {
            if (ModelState.IsValid)
            {
                DataBase.Add(model);
                return(View("Thanks", model));
            }

            return(View(model));
        }
Пример #12
0
        public Task InviteAsync(string email)
        {
            var invitationModel = new InvitationModel()
            {
                Recipient = email,
                Subject   = "History in Paderborn App Einladung"
            };

            return(_emailClient.EmailInvitationPostAsync(invitationModel));
        }
Пример #13
0
        private User GetInvitee(InvitationModel model)
        {
            if (model == null)
            {
                return(null);
            }
            var id            = model.Id;
            var seekedInvitee = _repo.GetUser(id);

            return(seekedInvitee);
        }
Пример #14
0
        public async Task <IActionResult> KickUserFromEvent([FromBody] InvitationModel model)
        {
            var result = await Task.FromResult(this._eventsManager.KickUserFromEvent(model));

            if (result.IsCompletedSuccessfully)
            {
                return(Ok());
            }

            return(StatusCode(StatusCodes.Status500InternalServerError));
        }
Пример #15
0
        protected bool PopulateModel(LoginModel loginModel = null)
        {
            //try
            //{
            if (decryptedLink != null && Invitation != null)
            {
                string         imisID  = GetLinkProperty("IMIS_ID");
                BAResult       result  = Shared.GetMyrcene("company/" + imisID);
                Models.Company company = JsonConvert.DeserializeAnonymousType(Shared.GetMyrcene("company/" + imisID).ResultData.ToString(), new Models.Company());

                //MYRCENE GenericEntityData companyResult = SOA.GetIQAResults("$/JoinNow/CompanyByIMISID", imisID).FirstOrDefault();
                //string companyName = companyResult.GetEntityProperty("FullName");
                Session["InvitationTitle"] = "Company Roster Registration for " + company.InstituteName;
                string email = (loginModel != null && loginModel.Email != null) ? loginModel.Email : GetLinkProperty("Email");
                //MYRCENE
                Person inviteeResults = GetInvitee(email);
                //GenericEntityData inviteeResults = GetInvitee(email);
                string userName = String.Empty;
                //username will only be pre-populated (i.e., in GetLinkProperty("userName")) if user clicked a password reset link sent from this website.
                userName        = (loginModel != null && loginModel.Username != null) ? loginModel.Username : GetLinkProperty("userName");
                invitationModel = new InvitationModel
                {
                    InvitationID      = Invitation.InvitationID,
                    InvitationIMIS_ID = imisID,
                    InstituteName     = company.InstituteName,
                    SentDateTime      = Convert.ToDateTime(GetLinkProperty("SentDateTime")),
                    Email             = email,
                    AdditionalEmails  = new List <string>()
                    {
                        String.Empty, String.Empty, String.Empty
                    },
                    InviteeIMIS_ID   = inviteeResults.ContactID,          //GetEntityProperty("ID"),
                    InviteeCompanyID = inviteeResults.InstituteContactID, //GetEntityProperty("CompanyID"),
                    FirstName        = inviteeResults.FirstName,          //GetEntityProperty("FirstName"),
                    MiddleName       = inviteeResults.MiddleName,         //GetEntityProperty("MiddleName"),
                    LastName         = inviteeResults.LastName,           //GetEntityProperty("LastName"),
                    MemberType       = inviteeResults.CustomerType,       //GetEntityProperty("MemberType"),
                    WorkPhone        = company.WorkPhone,                 //companyResult.GetEntityProperty("WorkPhone"),
                    ResetPassword    = GetLinkProperty("passwordReset") == "passwordReset",
                    Username         = userName,
                    Password         = (loginModel != null) ? loginModel.Password : null,
                    ATSMethod        = (loginModel != null) ? loginModel.ATSMethod : ATS.Methods.NotInitialized
                };
                invitationModel.HasIMISAccount = !(String.IsNullOrEmpty(invitationModel.InviteeIMIS_ID) || String.IsNullOrEmpty(invitationModel.MemberType));
                return(true);
            }
            //}
            //catch (Exception ex)
            //{
            //    throw new Exception("Could not retrieve invitee data.");
            //}
            return(false);
        }
Пример #16
0
 private WebUserInvitation WebUserInvitationMapper(InvitationModel model, long userId)
 {
     return(new WebUserInvitation
     {
         Email = model.Email,
         RoleId = model.RoleId.Value,
         UserId = null,
         InvitationApprovedDate = null,
         CreatedBy = userId,
         CreatedDate = DateTime.Now
     });
 }
Пример #17
0
        public async Task <IActionResult> Invitation(
            InvitationModel invitation,
            [FromServices] InvitationService inviter)
        {
            var result = await inviter.Invite(invitation);

            return(View(new InvitationModel
            {
                Email = invitation.Email,
                InvitationResponse = result,
            }));
        }
        public ActionResult SendInvitation(InvitationModel model)
        {
            using (SqlConnection connection = new SqlConnection(connectionString))
            {
                connection.Open();
                SqlCommand command = new SqlCommand("insert into emailtofriends(name, email, message) values (@name, @email, @message)", connection);
                command.Parameters.AddWithValue("name", model.Name);
                command.Parameters.AddWithValue("email", model.Email);
                command.Parameters.AddWithValue("message", model.Message);

                try
                {
                    command.ExecuteNonQuery();
                }
                catch (SqlException ex)
                {
                    // do what?

                }
                finally
                {
                    connection.Close();
                }

                //Send mandril message
                try
                {
                    MandrillApi api = new MandrillApi(ProjectConfiguration.MandrillApiKey);
                    var emailMessage = new EmailMessage()
                    {
                        To = new List<EmailAddress>() { new EmailAddress(model.Email, "Invited") },
                        FromEmail = ProjectConfiguration.FromEmail,
                        FromName = ProjectConfiguration.FromName,
                        Subject = string.Format(ProjectConfiguration.InvitationEmailSubject, model.Name),
                        Merge = true,
                        MergeLanguage = "mailchimp"
                    };

                    emailMessage.AddGlobalVariable("invitername", model.Name);
                    emailMessage.AddGlobalVariable("invitermessage", model.Message.Replace("\n", "<br />"));

                    var request = new SendMessageTemplateRequest(emailMessage, "invitation", null);
                    var result = api.SendMessageTemplate(request);
                }
                catch (Exception ex)
                {
                    // do what?
                }

                return new EmptyResult();
            }
        }
Пример #19
0
        public long InsertWebUserInvitation(InvitationModel model, long userId)
        {
            var checkExistInvite = _employeeRepository.GetWebUserInvitationByEmail(model.Email);

            if (checkExistInvite != null)
            {
                throw new Exception("Kontot finns redan.");
            }
            var webUserInvitation = WebUserInvitationMapper(model, userId);
            var invitationId      = _employeeRepository.InsertWebUserInvitation(webUserInvitation);

            return(invitationId);
        }
Пример #20
0
        internal async Task <CreateInvitationResponse> Invite(InvitationModel invitation)
        {
            var client = new HttpClient();
            var disco  = await client.GetDiscoveryDocumentAsync(IdentityServiceHost);

            if (disco.IsError)
            {
                throw new Exception(disco.Error);
            }

            var tokenResponse = await client.RequestClientCredentialsTokenAsync(new ClientCredentialsTokenRequest
            {
                Address      = disco.TokenEndpoint,
                ClientId     = "client",
                ClientSecret = "511536EF-F270-4058-80CA-1C89C192F69A",
                Scope        = "api1"
            });

            if (tokenResponse.IsError)
            {
                throw new Exception(tokenResponse.Error);
            }

            using (var httpClient = new HttpClient())
            {
                httpClient.SetBearerToken(tokenResponse.AccessToken);

                var inviteJson = JsonConvert.SerializeObject(new
                {
                    sourceId     = Guid.NewGuid().ToString(),
                    givenName    = "Bobby",
                    familyName   = "Bob",
                    email        = invitation.Email,
                    userRedirect = "https://localhost:7070/Account/SignIn",
                    callback     = "https://localhost:7070/Account/Callback"
                });

                var response = await httpClient.PostAsync(
                    $"{IdentityServiceHost}/Invitations/36BCFAAD-1FF7-49CB-8EEF-19877B7AD0C9",
                    new StringContent(inviteJson, Encoding.UTF8, "application/json")
                    );

                response.EnsureSuccessStatusCode();

                var content = await response.Content.ReadAsStringAsync();

                var result = JsonConvert.DeserializeObject <CreateInvitationResponse>(content);
                result.LoginLink = $"{IdentityServiceHost}/Invitations/CreatePassword/{result.InvitationId}";
                return(result);
            }
        }
Пример #21
0
 public User AddInvitation(string projectName, string invitedUser)
 {
     using (var context = new ThemisContext())
     {
         var invitation = new InvitationModel()
         {
             Name     = projectName,
             username = invitedUser
         };
         context.Invitation.Add(invitation);
         context.SaveChanges();
         return(context.Users.Find(invitedUser));
     }
 }
Пример #22
0
        public async Task <ActionResult> InviteToJoin(InvitationModel model)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    var invitee = db.Users.FirstOrDefault(u => u.Email == model.EmailTo);
                    var me      = db.Users.Find(User.Identity.GetUserId());
                    model.Id = me.HouseholdId.Value;
                    if (invitee != null && invitee.HouseholdId == model.Id)
                    {
                        return(RedirectToAction("UserAlreadyAssignedToHousehold"));
                    }

                    var callbackUrl = "";
                    if (invitee != null)
                    {
                        callbackUrl = Url.Action("JoinHousehold", "Households", new { id = model.Id }, protocol: Request.Url.Scheme);
                    }
                    else
                    {
                        callbackUrl = Url.Action("Register", "Account", new { id = model.HouseholdId }, protocol: Request.Url.Scheme);
                    }

                    var body    = "<p>Email From: <bold>{0}</bold>({1})</p><p>Message:</p><p>{2}</p>";
                    var from    = "FinancialPortal<" + me.Email + ">";
                    var subject = "Invitation to Join Household!";
                    var to      = model.EmailTo;


                    var email = new MailMessage(from, to)
                    {
                        Subject    = subject,
                        Body       = string.Format(body, me.FullName, model.Body, "Please click on the link below to confirm invitation: <br /> <a href=\"" + callbackUrl + "\">Link to invitation.</a>"),
                        IsBodyHtml = true
                    };
                    var svc = new PersonalEmail();
                    await svc.SendAsync(email);

                    return(RedirectToAction("InviteSent"));
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                    await Task.FromResult(0);
                }
            }
            return(View(model));
        }
 private void ReplacePunctuation(ref InvitationModel model)
 {
     if (model.FirstName != null)
     {
         model.FirstName = model.FirstName.Replace(".", String.Empty);
     }
     if (model.MiddleName != null)
     {
         model.MiddleName = model.MiddleName.Replace(".", String.Empty);
     }
     if (model.LastName != null)
     {
         model.LastName = model.LastName.Replace(".", String.Empty);
     }
 }
 public IHttpActionResult AddInvited(InvitationModel model)
 {
     try
     {
         if (ModelState.IsValid)
         {
             DataBase.Add(model);
             return(Ok("Ok"));
         }
         return(NotFound());
     }
     catch (Exception)
     {
         return(NotFound());
     }
 }
Пример #25
0
        public async Task KickUserFromEvent(InvitationModel model)
        {
            var user = await this._userManager.FindByNameAsync(model.Username);

            if (user != null)
            {
                var query = await(from participants in this._dbContext.EventParticipants
                                  where participants.EventId == model.EventId &&
                                  participants.UserId == user.Id
                                  select participants).FirstOrDefaultAsync();

                if (query != null)
                {
                    this._dbContext.Remove(query);
                    await this._dbContext.SaveChangesAsync();
                }
            }
        }
Пример #26
0
        public IHttpActionResult AddInvitation([FromBody] InvitationModel invitationModel)
        {
            //******* Create .ics file to add an event *********
            string schLocation    = "Invitation Location";
            string schSubject     = "Invitation";
            string schDescription = "Invitation description";

            System.DateTime schBeginDate = invitationModel.InvitationDateTime;
            //System.DateTime schEndDate = Convert.ToDateTime("18/2/2018 11:00:00 PM");

            //PUTTING THE MEETING DETAILS INTO AN ARRAY OF STRING

            String[] contents = { "BEGIN:VCALENDAR",
                                  "PRODID:-//Flo Inc.//FloSoft//EN",
                                  "BEGIN:VEVENT",
                                  "DTSTART:" + schBeginDate.ToUniversalTime().ToString("yyyyMMdd\\THHmmss\\Z"),
                                  "DTEND:" + schBeginDate.ToUniversalTime().ToString("yyyyMMdd\\THHmmss\\Z"),
                                  "LOCATION:" + schLocation,
                                  "DESCRIPTION;ENCODING=QUOTED-PRINTABLE:" + schDescription,
                                  "SUMMARY:" + schSubject,                                                     "PRIORITY:3",
                                  "END:VEVENT",
                                  "END:VCALENDAR" };

            /*THE METHOD 'WriteAllLines' CREATES A FILE IN THE SPECIFIED PATH WITH
             * THE SPECIFIED NAME,WRITES THE ARRAY OF CONTENTS INTO THE FILE AND CLOSES THE
             * FILE.SUPPOSE THE FILE ALREADY EXISTS IN THE SPECIFIED LOCATION,THE CONTENTS
             * IN THE FILE ARE OVERWRITTEN*/

            // System.IO.File.WriteAllLines(Server.MapPath("Sample.ics"), contents);
            string datetimeNow = DateTime.Now.ToString("yyyyMMddHHmmss");
            string fileName    = "Invitation" + datetimeNow + ".ics";

            System.IO.File.WriteAllLines(HttpContext.Current.Server.MapPath("~/InvitationsICS/" + fileName), contents);

            //*********************************************

            var invitationID = _invitationFacade.AddInvitation(Mapper.Map <InvitationDTO>(invitationModel), UserId, fileName);


            return(Ok(new InvitationModel {
                InvitationID = invitationID
            }));
        }
Пример #27
0
        public async Task <HttpStatusCode> CreateInvitation(InvitationModel invitationModel)
        {
            var dataContext = new HambasafeDataContext();

            var invitationEntity = new Invitation()
            {
                InvitorUserId        = invitationModel.InvitorUserId,
                InviteeUserId        = invitationModel.InviteeUserId,
                EventId              = invitationModel.EventId,
                OptionalEmailInvitee = invitationModel.OptionalEmailInvitee,
                Status  = invitationModel.Status,
                Comment = invitationModel.Comment
            };

            dataContext.Invitations.Add(invitationEntity);
            await dataContext.SaveChangesAsync();

            return(HttpStatusCode.OK);
        }
Пример #28
0
        public async Task <IActionResult> InviteUsers(InvitationModel data)
        {
            // Do the critical path work: actually get
            // the users/emails into the system.
            await InsertUsersIntoDatabase(data.EmailList);

            // Then queue the non-critical path work
            // in a separate async-job: email
            // invitations will be sent to each user.
            // This also makes the job of sending
            // emails fault tolerant in case of
            // temporary errors while sending a message.
            Guid runId = await jobs.SendPendingInvitations();

            return(View("Results", new RunResultsModel
            {
                RunId = runId
            }));
        }
Пример #29
0
        public void SendInvitation(InvitationModel model, long userId)
        {
            var checkEmail = _accessTokenRepository.GetWebUserByEmail(model.Email);

            if (checkEmail != null)
            {
                throw new Exception("L'identificador de correu electrònic ja existeix.");
            }

            var invitationId = InsertWebUserInvitation(model, userId);
            var webUrl       = ConfigurationManager.AppSettings["WebUrl"];
            var fields       = new StringDictionary
            {
                { "signUpUrl", string.Format("{0}{1}{2}", webUrl, "/Employee/Invitation/", invitationId) }
            };
            var htmlBody = _fm.ReadFileContents(GetMailerTemplatePath("html", "CreateEmployeePage")).ReplaceMatch(fields);

            _emailNotifier.SendEmail(model.Email, htmlBody, "Invitation");
        }
        public static void ShowInvitationDialog(
            InvitationModel invitation,
            Action completed = null,
            Action cancelled = null)
        {
            var invitationDialog = new InvitationDialog();

            var dialogFrame = new DialogFrame(
                invitationDialog,
                "Add member",
                invitation,
                Color.FromArgb(0xFF, 0xD8, 0xC3, 0xD4),
                completed,
                cancelled);

            invitationDialog.Ok     += dialogFrame.OnOk;
            invitationDialog.Cancel += dialogFrame.OnCancel;

            dialogFrame.Open();
        }
Пример #31
0
        public async Task <IActionResult> InviteUser([FromBody] InvitationModel invitationModel)
        {
            if (invitationModel == null)
            {
                return(BadRequest());
            }

            try
            {
                var userId = GetCurrentUserId();

                await _invitationService.SendInvitation(invitationModel.Email, invitationModel.Name, userId);

                return(Ok());
            }
            catch (Exception ex)
            {
                _logger.LogError(ex.Message);
                return(BadRequest());
            }
        }