public IActionResult Create(int id, Author user) { var model = AuthorList.getInstance(); model.add(user); return(RedirectToAction("Index")); }
//----< deletes a story by id >----------------------------- /* * - note that Delete does not send back a view, but * simply redirects back to the Index view, which * will not show the deleted course because it was ... */ public IActionResult Delete(int id) { var styList = AuthorList.getInstance(); styList.delete(id - 1); return(RedirectToAction("Index")); }
public IActionResult Edit(int id, Author user) { var model = AuthorList.getInstance(); model[id - 1] = user; return(RedirectToAction("Index")); }
public IActionResult Edit(int id) { var userList = AuthorList.getInstance(); var model = userList[id - 1]; return(View(model)); }
//----< shows details for each story >---------------------- public ViewResult Details(int id) { var model = AuthorList.getInstance(); var user = model[id - 1]; return(View(user)); }
// GET: /<controller>/ public IActionResult Index() { var model = AuthorList.getInstance(); IEnumerable <Author> userList = (IEnumerable <Author>)model.Authors; return(View(userList)); }
public IActionResult Create(int id) { var userList = AuthorList.getInstance(); var model = new Author(); model.Id = userList.size() + 1; return(View(model)); }