public IActionResult Edit(int id, [Bind("Id,FirstName,LastName,Description")] Speaker speaker) { if (id != speaker?.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _speakerRepository.Update(speaker); } catch (DbUpdateConcurrencyException) { if (!SpeakerExists(speaker.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(speaker)); }
public IActionResult Edit(int id, Speaker speaker) { if (id != speaker?.Id) { return(NotFound()); } try { _speakerRepository.Update(speaker); } catch (DbUpdateConcurrencyException) { if (!SpeakerExists(speaker.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); }
private void UpdateSpeakerData(ISpeaker speaker, SyndicationItem item, string eventName, string year) { try { var hostedPageLink = string.Empty; if (item.Links != null && item.Links.Count > 0) { var link = item.Links.Where(l => l.RelationshipType != null && l.RelationshipType == "alternate").FirstOrDefault(); if (link != null && link.Uri != null) { hostedPageLink = link.Uri.AbsoluteUri; } } speaker.Name = item.Title.Text; speaker.PublishDate = item.PublishDate.LocalDateTime; speaker.HostedPageLink = hostedPageLink; speaker.Summary = HttpUtility.HtmlDecode(GetExtensionElementValue(item, "summary")); speaker.EventYear = year; speaker.EventName = eventName; _speakerRepository.Update(speaker); } catch (Exception ex) { Debug.WriteLine(ex.ToString()); } }
public Speakers Update(Speakers speakers) { var update = speakerRepository.Update(speakers); return(update); }