public ActionResult Create(ViewTemplateInputModel input) { if (ModelState.IsValid) { var template = Mapper.Map<ViewTemplate>(input); template = Templates.Add(template); return RedirectToAction("Details", new { id = template.Id }); } return View(input); }
public ActionResult Edit(string id, ViewTemplateInputModel input) { var template = Templates.GetById(id); if (id == null) return HttpNotFound("No such view template"); if (ModelState.IsValid) { Mapper.Map(input, template); Templates.Update(template); return RedirectToAction("Details", new { id = template.Id }); } return View(input); }
public ActionResult Create() { var input = new ViewTemplateInputModel(); return View(input); }