public Task <IActionResult> GetEntities() { return(Task.Factory.StartNew <IActionResult>(() => { var rows = ManagerRoleRepository.Get().ToList(); return Json(ExcutedResult.SuccessResult(rows)); })); }
/// <summary> /// 新增或者修改服务 /// </summary> /// <param name="item">新增或者修改试图实体</param> /// <returns>结果实体</returns> public BaseResult AddOrModify(ManagerRoleAddOrModifyModel item) { var result = new BaseResult(); ManagerRole managerRole; if (item.Id == 0) { //TODO ADD managerRole = _mapper.Map <ManagerRole>(item); managerRole.AddManagerId = 1; managerRole.IsDelete = false; managerRole.AddTime = DateTime.Now; if (_repository.Insert(managerRole) > 0) { result.ResultCode = ResultCodeAddMsgKeys.CommonObjectSuccessCode; result.ResultMsg = ResultCodeAddMsgKeys.CommonObjectSuccessMsg; } else { result.ResultCode = ResultCodeAddMsgKeys.CommonExceptionCode; result.ResultMsg = ResultCodeAddMsgKeys.CommonExceptionMsg; } } else { //TODO Modify managerRole = _repository.Get(item.Id); if (managerRole != null) { _mapper.Map(item, managerRole); managerRole.ModifyManagerId = 1; managerRole.ModifyTime = DateTime.Now; if (_repository.Update(managerRole) > 0) { result.ResultCode = ResultCodeAddMsgKeys.CommonObjectSuccessCode; result.ResultMsg = ResultCodeAddMsgKeys.CommonObjectSuccessMsg; } else { result.ResultCode = ResultCodeAddMsgKeys.CommonExceptionCode; result.ResultMsg = ResultCodeAddMsgKeys.CommonExceptionMsg; } } else { result.ResultCode = ResultCodeAddMsgKeys.CommonFailNoDataCode; result.ResultMsg = ResultCodeAddMsgKeys.CommonFailNoDataMsg; } } return(result); }