public static UpdateConference ToUpdateConferenceCommand(this EditableConferenceInfo model, ConferenceInfo original) { var command = new UpdateConference(); command.AggregateRootId = original.Id; command.Name = model.Name; command.Description = model.Description; command.Location = model.Location; command.Tagline = model.Tagline; command.TwitterSearch = model.TwitterSearch; command.StartDate = model.StartDate; command.EndDate = model.EndDate; return(command); }
public ActionResult Edit(EditableConferenceInfo conference) { if (this.Conference == null) { return(HttpNotFound()); } if (ModelState.IsValid) { var edited = Mapper.Map(conference, this.Conference); this.Service.UpdateConference(edited); return(RedirectToAction("Index", new { slug = edited.Slug, accessCode = edited.AccessCode })); } return(View(this.Conference)); }
public async Task <ActionResult> Edit(EditableConferenceInfo conference) { if (this._conference == null) { return(HttpNotFound()); } if (!ModelState.IsValid) { return(View(conference)); } var command = conference.ToUpdateConferenceCommand(_conference); var result = await ExecuteCommandAsync(command); if (!result.IsSuccess()) { ModelState.AddModelError("Slug", result.GetErrorMessage()); return(View(conference)); } return(RedirectToAction("Index", new { slug = _conference.Slug, accessCode = _conference.AccessCode })); }
public ActionResult Edit(EditableConferenceInfo conference) { if (this.Conference == null) { return HttpNotFound(); } if (ModelState.IsValid) { var edited = Mapper.Map(conference, this.Conference); this.Service.UpdateConference(edited); return RedirectToAction("Index", new { slug = edited.Slug, accessCode = edited.AccessCode }); } return View(this.Conference); }