コード例 #1
0
 public ActionResult Edit(Contact contact)
 {
     var friendLogic = new FriendBUS();
     var friends =
         contact.Friends.Select(c => new Friend() {ContactId1 = c.Id, ContactId2 = contact.Id}).ToList();
     friendLogic.Save(contact, friends);
     return RedirectToAction("Edit", new {id = contact.Id});
 }
コード例 #2
0
        public ActionResult Edit(FriendEditViewModel model)
        {
            var friendLogic = new FriendBUS();
            var friends = model.Contact.Friends.Select(c => new Friend
            {
                ContactId1 = c.Id,
                ContactId2 = model.Contact.Id
            }).ToList();

            friendLogic.Save(model.Contact, friends);

            return RedirectToAction("Edit", new { id = model.Contact.Id });
        }