Exemplo n.º 1
0
 public ActionResult Create(Link link)
 {
     try
     {
         profile.Links.Add(link);
         return RedirectToAction("Edit", "Profile");
     }
     catch
     {
         return View();
     }
 }
Exemplo n.º 2
0
        public ActionResult Edit(Link newLink)
        {
            if (ModelState.IsValid)
            {
                Link link = profile.Links.First(l => l.ID == newLink.ID);
                link.Name = newLink.Name;
                link.Url = newLink.Url;

                return RedirectToAction("Edit", "Profile");
            }

            return View(newLink);
        }