コード例 #1
0
ファイル: ViewTemplateController.cs プロジェクト: pate/blog
        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
ファイル: ViewTemplateController.cs プロジェクト: pate/blog
        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
ファイル: ViewTemplateController.cs プロジェクト: pate/blog
 public ActionResult Create()
 {
     var input = new ViewTemplateInputModel();
     return View(input);
 }