public object EditState(AddStateDto addStateDto) { State state = _ctx.State.Find(addStateDto.Id); var result = new object(); try { state.Name = addStateDto.Name; state.Pay = addStateDto.Pay; _ctx.SaveChanges(); result = new { isSuccess = true, message = "编辑成功!", }; } catch { result = new { isSuccess = false, message = "编辑失败!", }; } return(result); }
public object EditPosition(AddStateDto addStateDto) { Position position = _ctx.Position.Find(addStateDto.Id); var result = new object(); try { position.Name = addStateDto.Name; position.Pay = addStateDto.Pay; _ctx.SaveChanges(); result = new { isSuccess = true, message = "编辑成功!", }; } catch { result = new { isSuccess = false, message = "编辑失败!", }; } return(result); }
public async Task <object> AddState([FromBody] AddStateDto addStateDto) { var context = HttpContext; string account = await _jwtUtil.GetMessageByToken(context); addStateDto.CompId = _commonAppService.GetUserCompId(account); return(_dangAnAppService.AddState(addStateDto)); }
public object AddPosition(AddStateDto addStateDto) { Position position = _ctx.Position.SingleOrDefault(p => p.CompanyId == addStateDto.CompId && p.Name.Equals(addStateDto.Name)); var result = new object(); if (position != null) { result = new { isSuccess = false, message = "该职位已经存在!", } } ; else { Position newPosition = new Position() { Name = addStateDto.Name, Pay = addStateDto.Pay, CompanyId = addStateDto.CompId, ParentId = addStateDto.ParentId, }; try { _ctx.Position.Add(newPosition); _ctx.SaveChanges(); result = new { isSuccess = true, message = "添加职位成功!", }; } catch { result = new { isSuccess = false, message = "添加失败!", }; } } return(result); }
public object AddState(AddStateDto addStateDto) { State state = _ctx.State.SingleOrDefault(p => p.CompanyId == addStateDto.CompId && p.Name.Equals(addStateDto.Name)); var result = new object(); if (state != null) { result = new { isSuccess = false, message = "该状态已经存在!", } } ; else { State newState = new State() { Name = addStateDto.Name, Pay = addStateDto.Pay, CompanyId = addStateDto.CompId }; try { _ctx.State.Add(newState); _ctx.SaveChanges(); result = new { isSuccess = true, message = "添加员工状态成功!", }; } catch { result = new { isSuccess = false, message = "添加失败!", }; } } return(result); }
public object EditState([FromBody] AddStateDto addStateDto) { return(_dangAnAppService.EditState(addStateDto)); }
public object EditPosition(AddStateDto addStateDto) { return(_dangAnManager.EditPosition(addStateDto)); }
public object EditState(AddStateDto addStateDto) { return(_dangAnManager.EditState(addStateDto)); }