Exemplo n.º 1
0
        public ActionResult Category(Guid id)
        {
            Fail.IfArgumentEmpty(id, nameof(id));

            var category = BookStore.GetCategory(id);
            var model    = new EditCategoryModel(category);

            return(View(model));
        }
Exemplo n.º 2
0
        public ActionResult CategoryUpdate([NotNull] EditCategoryModel model)
        {
            Fail.IfArgumentNull(model, nameof(model));
            Fail.IfArgumentEmpty(model.Id, nameof(model.Id));
            Fail.IfArgumentWhiteSpace(model.Name, nameof(model.Name));

            var category = BookStore.GetCategory(model.Id);

            category.Rename(model.Name);
            category.Book.Save();

            return(RedirectToCategoryEditor(category));
        }