public void ValidatePositions(int organizationID) { PhoneTypes phoneTypes = new PhoneTypes(LoginUser); phoneTypes.LoadAllPositions(organizationID); int i = 0; foreach (PhoneType phoneType in phoneTypes) { phoneType.Position = i; i++; } phoneTypes.Save(); }
public void MovePositionUp(int phoneTypeID) { PhoneTypes types1 = new PhoneTypes(LoginUser); types1.LoadByPhoneTypeID(phoneTypeID); if (types1.IsEmpty || types1[0].Position < 1) { return; } PhoneTypes types2 = new PhoneTypes(LoginUser); types2.LoadByPosition(types1[0].OrganizationID, types1[0].Position - 1); if (!types2.IsEmpty) { types2[0].Position = types2[0].Position + 1; types2.Save(); } types1[0].Position = types1[0].Position - 1; types1.Save(); ValidatePositions(LoginUser.OrganizationID); }