示例#1
0
        public ActionResult Create(BrandModel model)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    unitOfWork.BrandRepository.Insert(model);
                    unitOfWork.Save();
                    return RedirectToAction("Index");
                }

                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }
示例#2
0
        public ActionResult Edit(int id, BrandModel model)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    var _data = unitOfWork.BrandRepository.GetByID(model.ID);
                    _data.IsActive = model.IsActive;
                    _data.Name = model.Name;
                    _data.Detail = model.Detail;
                    _data.LastUpdate = DateTime.Now;
                    unitOfWork.BrandRepository.Update(_data);
                    unitOfWork.Save();
                    return RedirectToAction("Index");
                }

                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }