public ActionResult Edit(int?id) { try { ViewBag.TypeId = new SelectList(TempType.GetList(), "Id", "Description"); TempModel model = Startup.ModelList.FirstOrDefault(m => m.Id == id); if (model == null) { string id_string = id == null ? "null" : id.ToString(); ViewBag.ErrorMessage = $"Cannot find item with Id {id_string}"; return(View("Error")); } return(View(model)); } catch (Exception ex) { _log.Error(ex); ViewBag.ErrorMessage = ex.Message; return(View("Error")); } }
public ActionResult Create() { ViewBag.TypeId = new SelectList(TempType.GetList(), "Id", "Description"); return(View()); }