public RedirectResult addFrend(string username) { AddingFriend f = new AddingFriend(); f.UserFriend = username; Create(f); return new RedirectResult(Url.Action("UserData", "Account", new {user = username } )); }
public ActionResult Create(AddingFriend friend) { if (Membership.GetUser(friend.UserFriend) != null) { Friendship fs = new Friendship(); fs.User = (Guid)Membership.GetUser().ProviderUserKey; fs.UserFriend = (Guid)Membership.GetUser(friend.UserFriend).ProviderUserKey; db.Friendships.Add(fs); db.SaveChanges(); } return RedirectToAction("Index"); }