예제 #1
0
        public ActionResult Create(LocationModel model)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    unitOfWork.LocationRepository.Insert(model);
                    unitOfWork.Save();
                    return RedirectToAction("Index");
                }

                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }
예제 #2
0
        public ActionResult Edit(int id, LocationModel model)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    var _data = unitOfWork.LocationRepository.GetByID(model.ID);
                    _data.IsActive = model.IsActive;
                    _data.LocationName = model.LocationName;
                    _data.LocationCode = model.LocationCode;
                    _data.LastUpdate = DateTime.Now;
                    unitOfWork.LocationRepository.Update(_data);
                    unitOfWork.Save();
                    return RedirectToAction("Index");
                }

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