コード例 #1
0
ファイル: CategoryService.cs プロジェクト: kkbruce/twMVC-18-1
        public IResult Create(Category instance)
        {
            if (instance == null)
            {
                throw new ArgumentNullException();
            }

            IResult result = new Result(false);
            try
            {
                this._repository.Create(instance);
                result.Success = true;
            }
            catch (Exception ex)
            {
                result.Exception = ex;
            }
            return result;
        }
コード例 #2
0
 public ActionResult Edit(Category category)
 {
     if (category != null &&
         ModelState.IsValid)
     {
         this.categoryService.Update(category);
         return View(category);
     }
     else
     {
         return RedirectToAction("index");
     }
 }