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); }