示例#1
0
        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);
        }
示例#2
0
        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);
        }
示例#3
0
 public ActionResult Create()
 {
     var input = new ViewTemplateInputModel();
     return View(input);
 }