public ActionResult SaveAuthGroupInfo(AuthGroupInfoModel model) { InkeyResult result = new InkeyResult(); string errorMessage; if (this.VerifyModle(out errorMessage)) { this._authManagerService.AddOrUpdateAllAuthGroupInfo(model); } else { result.Code = -101; result.Desc = errorMessage; } return(Json(result)); }
public void AddOrUpdateAllAuthGroupInfo(AuthGroupInfoModel model) { if (model.GroupId.HasValue) { using (var scope = AutoEfRepositoryFactory.GetEfRepositoryFactory(DataSources.DataSource_ItAdmin).CreateReadWriteContextScope()) { var groupInfo = this._efAuthGroupInfoRepository.GetById(model.GroupId.Value); groupInfo.Code = model.Code; groupInfo.Name = model.Name; this._efAuthGroupInfoRepository.Update(groupInfo); scope.SaveChanges(); } } else { this._efAuthGroupInfoRepository.Insert(new AuthGroupInfoEntity { Id = Guid.NewGuid(), Name = model.Name, Code = model.Code, CreateTime = DateTime.Now }); } }