public void SendInvitationToTargetedUser(CreateInvitationBindModel model) { var targetedUser = this.Data.GetById(model.TargetedUserId); var sender = this.Data.GetById(model.SenderId); var team = sender.MemberTeams.Where(t => !t.IsDeleted).FirstOrDefault(t => t.Id == model.TeamId); Invitation invitation = new Invitation() { User = targetedUser, Team = team, }; targetedUser.Invitations.Add(invitation); this.invitations.Add(invitation); this.invitations.Save(); }
public ActionResult SendInvitation([Bind(Include = "TargetedUserId, TeamId, SenderId")] CreateInvitationBindModel model) { this.service.SendInvitationToTargetedUser(model); return(this.RedirectToAction("AllUsers")); }