public async Task <ActionResult> Application(ParticipantsViewModel pvm) { // Add the application to the database var db = new EstiemPortalContext(); var evp = new EVENTS_Participants { UserId = pvm.UserId, EventID = pvm.EventId, RegistrationDate = DateTime.Now, RegistrationStatus = 1, // RegistrationStatus 1 means waiting, which is default when applying. Comments = "", CmStatus = 0, MotivationText = pvm.MotivationText, Vegetarian = pvm.Vegetarian, NoPork = pvm.EatPork, VisaRequired = pvm.RequireVisa }; db.EVENTS_Participants.Add(evp); db.SaveChanges(); Response.Redirect("~/Events/Index"); // Post application info to Slack string urlWithAccessToken = "https://hooks.slack.com/services/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"; Slack slack = new Slack(urlWithAccessToken); var evrepo = new EventRepository(); Event ev = evrepo.GetEventById(pvm.EventId); var usrrepo = new UserRepository(); User usr = usrrepo.GetUserById(pvm.UserId); //slack.PostMessage(username: "******", // text: usr.UserName + " applied for " + ev.Name, // channel: "#estiem-mobile"); // Slack invite to channel // Invite applying user to the group of the event // Should this be applying or after registration? string parameters = "?token=" + System.Configuration.ConfigurationManager.AppSettings["SlackToken"] + "?name=" + pvm.Event.Name; var resp = await slack.PostToSlack("groups.invite", parameters); return(View()); }
public void AddEventParticipant(EVENTS_Participants evp) { // Not needed currently }