Пример #1
0
        public async Task <IActionResult> UpdateUserShift([FromBody] UpdateUserDto updatedUser)
        {
            var newUser = new User
            {
                UserId       = updatedUser.UserId,
                AccountId    = updatedUser.AccountId,
                FirstName    = updatedUser.FirstName,
                LastName     = updatedUser.LastName,
                Gender       = updatedUser.Gender,
                DepartmentId = updatedUser.DepartmentId,
                PositionId   = updatedUser.PositionId
            };
            await _userShiftRepo.DeleteAsync(d => d.UserId == updatedUser.UserId);

            await _userRepo.UpdateAsync(newUser);

            if (updatedUser.UserShifts.Count > 0)
            {
                foreach (var userShift in updatedUser.UserShifts)
                {
                    var newUserShift = new UserShift
                    {
                        ShiftId = userShift.ShiftId,
                        UserId  = userShift.UserId,
                        Day     = userShift.Day
                    };
                    await _userShiftRepo.CreateAsync(newUserShift);
                }
            }
            return(Ok(await GetUserList()));
        }
Пример #2
0
 public async Task <IActionResult> DeleteLeaveInfo(int id)
 {
     return(Ok(await _leaveReqRepo.DeleteAsync(d => d.LeaveRequestId == id)));
 }
Пример #3
0
 public async Task <IActionResult> DeleteUserInfo(Guid id)
 {
     return(Ok(await _userRepo.DeleteAsync(d => d.UserId == id)));
 }