Exemplo n.º 1
0
 public IActionResult AddLink(int id, [Bind] LinkViewModel model)
 {
     if (ModelState.IsValid)
     {
         var @event = _eventMapper.Find(id);
         if (@event == null)
         {
             return(NotFound());
         }
         var link = new Link {
             Description = model.Description, Url = model.Url, IsDeleted = false
         };
         @event.Links = @event.Links ?? new List <Link>();
         @event.Links.Add(link);
         _eventMapper.Update(@event);
     }
     return(RedirectToAction(nameof(Edit), new { Id = id }));
 }