Ejemplo n.º 1
0
        public ActionResult Edit(FormCollection formCollection, UserAuthViewModel vo)
        {
            if (ModelState.IsValid)
            {
                if (vo.Type == (int)AuthDataType.Promotion)
                    vo.BrandId = 0;
                var entity = _authRepo.Find(vo.Id);
                if (entity == null)
                    throw new ApplicationException("entity not exists!");
                entity.Status = vo.Status;
                entity.Type = vo.Type;
                entity.UserId = vo.UserId;
                entity.StoreId = vo.StoreId;
                entity.BrandId = vo.BrandId;
               
                _authRepo.Update(entity);
                return RedirectToAction("List");
            }
            return View(vo);

        }
Ejemplo n.º 2
0
        public ActionResult Create(FormCollection formCollection, UserAuthViewModel vo)
        {
            if (ModelState.IsValid)
            {
                if (vo.Type == (int)AuthDataType.Promotion)
                    vo.BrandId = 0;
                var entity = vo.ToEntity<UserAuthEntity>();
                entity.CreatedUser = base.CurrentUser.CustomerId;
                entity.CreatedDate = DateTime.Now;
                entity.Status = (int)DataStatus.Normal;
                _authRepo.Insert(entity);
                return RedirectToAction("Edit", new { Id = entity.Id});
            }

            return View(vo);
        }