예제 #1
0
        public ActionResult Edit(CategoryModel model)
        {
            try
            {
                var entity = model.ToEntity<CategoryModel, Category>();
                entity.LastModifiedDate = DateTime.Now;
                Handler.Update(entity);
            }
            catch (Exception ex)
            {
                model.Error = ex.Message;
                return View("Edit", model);
            }

            return RedirectToAction("Index");
        }
예제 #2
0
        public ActionResult Add(CategoryModel model)
        {
            try
            {
                var entity = model.ToEntity<CategoryModel, Category>();
                entity.CreationDate = DateTime.Now;
                Handler.Add(entity);
            }
            catch (Exception ex)
            {
                model.Error = ex.Message;
                return View("Add", model);
            }

            return RedirectToAction("Index");
        }