Ejemplo n.º 1
0
        public ActionResult Edit(EntryInput input)
        {
            var entry = _entryService.Single(input.Slug);
            input.MapPropertiesToInstance(entry);

            _entryService.Update(entry);
            ViewBag.EntryLink = LinkToEntry(entry.Slug);

            return View("Add", input);
        }
Ejemplo n.º 2
0
        public ActionResult Add(EntryInput model)
        {
            if (ModelState.IsValid)
            {
                var entry = Mapper.Map<Entry>(model);

                var success = _entryService.Add(entry);

                if (success)
                {
                    ViewBag.EntryLink = LinkToEntry(entry.Slug);
                    RefreshEntryCount();
                    return View();
                }

                ModelState.AddModelError("", "You have previously published a blog entry with this slug. Please choose another one.");
            }

            return View(model);
        }