private void mView_Send(object sender, EventArgs e) { var dto = new DtoAuthor { AuthorId = mView.AuthorId, FirstName = mView.FirstName, LastName = mView.LastName }; if (dto.AuthorId > 0) { mView.Message = _authorDm.Update(dto); } else { mView.Message = _authorDm.Add(dto); } }
public IActionResult OnPost(string submit) { if (submit == "Cancel") { return(RedirectToPage("Index")); } if (!ModelState.IsValid) { return(Page()); } _authorDm.Update(Author); return(RedirectToPage("Index")); }
public ActionResult Edit(int id = 0) { return(id == 0 ? null : View(adm.Update(id))); }