public ActionResult Send(int replyToProfileId = -1) { ShareEventViewModel sevm = new ShareEventViewModel(); sevm.EventID = -1; int profId = accountServices.GetUserProfileByUsername(User.Identity.Name).UserProfileId; sevm.SharerID = profId; sevm.FriendList = accountServices.GetAllFriends(new GetFriendsModel { UserProfileId = profId }); sevm.SharedUserProfileIDList = ""; UserProfileModel friend = accountServices.GetUserProfileByUserProfileId(replyToProfileId); if (friend != null) { sevm.SharedUserProfileIDList += "" + friend.UserProfileId; sevm.SharedIDList += (friend.FirstName + " " + friend.LastName); } return View(sevm); }
public ActionResult Share(ShareEventViewModel model) { string[] userProfileIDstring = model.SharedUserProfileIDList.Split(','); HashSet<int> userProfileIDs = new HashSet<int>(); foreach (String s in userProfileIDstring) { if (!s.Equals("")) userProfileIDs.Add(Int32.Parse(s)); } List<int> userIDs = new List<int>(); foreach (int i in userProfileIDs) { userIDs.Add(accountServices.GetUserByUserProfileId(i).UserId); } eventServices.Share(new ShareEventModel { EventID = model.EventID, Message = model.Message, SharerProfileId = accountServices.GetUserProfileByUsername(User.Identity.Name).UserProfileId, SharedProfileIDList = userIDs }); return RedirectToAction("Index", new { id = model.EventID }); }
public ActionResult Share(int id = 0) { if (id != 0) { ShareEventViewModel sevm = new ShareEventViewModel(); sevm.EventID = id; int profId = accountServices.GetUserProfileByUsername(User.Identity.Name).UserProfileId; sevm.SharerID = profId; sevm.FriendList = accountServices.GetAllFriends(new GetFriendsModel { UserProfileId = profId }); sevm.SharedUserProfileIDList = ""; return View(sevm); } return RedirectToAction("Index", "Home"); //error ito dapat }