public async Task <EducationViewModel <SaveEducationResource> > UpdateOrderIndexEducation(SwapOrderIndexRequestModel swapId) { model.AppResult.Result = false; var tempCurrentEducationInfo = await _educationRepository.FindAsync(swapId.CurrentId); var tempTurnedEducationInfo = await _educationRepository.FindAsync(swapId.TurnedId); if (tempCurrentEducationInfo is null || tempTurnedEducationInfo is null) { model.AppResult.Message = Constant.SWAP_ERROR; return(model); } // Set who edited? tempCurrentEducationInfo.UpdatedBy = Helpers.HttpContext.CurrentUser; tempCurrentEducationInfo.UpdatedAt = DateTime.Now; tempTurnedEducationInfo.UpdatedBy = Helpers.HttpContext.CurrentUser; tempTurnedEducationInfo.UpdatedAt = DateTime.Now; // Swap orderIndex int tempOrderIndex = 0; tempOrderIndex = tempCurrentEducationInfo.OrderIndex; tempCurrentEducationInfo.OrderIndex = tempTurnedEducationInfo.OrderIndex; tempTurnedEducationInfo.OrderIndex = tempOrderIndex; // Execute swap var isSuccess = await _educationRepository.SwapOrderIndexAsync(tempCurrentEducationInfo, tempTurnedEducationInfo); if (isSuccess) { model.AppResult.Result = true; model.AppResult.Message = Constant.SWAP_SUCCESS; return(model); } model.AppResult.Message = "Taylor Swift"; return(model); }