コード例 #1
0
ファイル: StoreController.cs プロジェクト: xuantranm/V3System
        public ActionResult Create(int? id)
        {
            var userName = System.Web.HttpContext.Current.User.Identity.Name;
            var user = _systemService.GetUserAndRole(0, userName);
            if (user == null)
            {
                return RedirectToAction("Index", "Login");
            }

            if (user.StoreR == 0)
            {
                return RedirectToAction("Index", "Home");
            }

            var item = new Store();

            if (id.HasValue)
            {
                item = _service.GetByKey(id.Value);
            }

            var model = new StoreViewModel
            {
                Id = item.Id,
                Code = item.Code,
                Name = item.Name,
                CountryId = item.CountryId,
                Address = item.Address,
                Tel = item.Tel,
                Phone = item.Phone,
                Description = item.Description,
                Timestamp = item.Timestamp,
                iCreated = item.iCreated,
                dCreated = item.dCreated,
                UserLogin = user,
                Countries = new SelectList(_systemService.CountryList(), "Id", "Name")
            };

            // FUNCTION
            return View(model);
        }
コード例 #2
0
ファイル: StoreService.cs プロジェクト: xuantranm/V3System
 public bool Update(Store store)
 {
     _repository.Update(store);
     _unitOfWork.CommitChanges();
     return true;
 }
コード例 #3
0
ファイル: StoreService.cs プロジェクト: xuantranm/V3System
 public bool Insert(Store store)
 {
     _repository.Add(store);
     _unitOfWork.CommitChanges();
     return true;
 }