コード例 #1
0
        public JsonResult InviteOthersToBunch(InviteOthersToBunchModel _InviteOthersToBunchModel)
        {
            var  currentUser = idb.Users.Find(User.Identity.GetUserId());
            Task T           = new Task(() =>
            {
                Ride _Ride = repository.GetRideByIDIncludeGroup(_InviteOthersToBunchModel.RideId);
                List <string> UserNames = new List <string>();

                if (_InviteOthersToBunchModel.InviteUsers != null)
                {
                    foreach (InviteUser item in _InviteOthersToBunchModel.InviteUsers)
                    {
                        UserNames.Add(item.UserName);
                    }
                    UserHelper _UserHelp = new UserHelper();
                    _UserHelp.SendUsersBunchInviteEmail(_UserHelp.GetEmailsForUserNames(UserNames),
                                                        _InviteOthersToBunchModel.RideId,
                                                        currentUser.UserName, _Ride.RideDate.ToString("dd/MM/yyyy"), _Ride.Group.name);
                }
            });

            T.Start();
            return(Json(new
            {
                success = true,
                message = "Emails Sent",
                RideId = _InviteOthersToBunchModel.RideId
            }, JsonRequestBehavior.AllowGet));
        }
コード例 #2
0
        public ActionResult InviteOthersToBunch(int RideId, int PreviousID = -1)
        {
            Ride _Ride = repository.GetRideByIDIncludeGroup(RideId);
            InviteOthersToBunchModel _InviteOthersToBunchModel = new InviteOthersToBunchModel
            {
                RideId     = _Ride.id,
                Name       = _Ride.Group.name,
                RideDate   = _Ride.RideDate.ToString("dd/MM/yyyy"),
                PreviousID = PreviousID
            };

            return(View(_InviteOthersToBunchModel));
        }