/// <summary> /// Level: Logic /// </summary> /// <param name="UserTypeID">The UserTypeID</param> /// <returns>UserTypeDelete Enum</returns> public UserTypeDelete DeleteUserType(int UserTypeID) { try { UserTypesRepository myRepository = new UserTypesRepository(); if (myRepository.UserTypeIsRetailerOrWholesaler(UserTypeID)) { return(UserTypeDelete.LockedUserType); } else if (myRepository.UserTypeHasUsers(UserTypeID)) { return(UserTypeDelete.HasUsers); } else { myRepository.DeleteUserType(UserTypeID); return(UserTypeDelete.Successful); } } catch (Exception Exception) { throw Exception; } }
/// <summary> /// Updates a UserType /// Level: Logic /// </summary> /// <param name="UserTypeID">The UserTypeID</param> /// <param name="UserType">The UserType</param> /// <returns>UserTypeUpdate Enum</returns> public UserTypeUpdate UpdateUserType(int UserTypeID, string UserType) { try { UserTypesRepository myRepository = new UserTypesRepository(); if (myRepository.UserTypeIsRetailerOrWholesaler(UserTypeID)) { return(UserTypeUpdate.LockedUserType); } else if (myRepository.UserTypeExists(UserType)) { return(UserTypeUpdate.SameUserType); } else { myRepository.UpdateUserType(UserTypeID, UserType); return(UserTypeUpdate.Successful); } } catch (Exception Exception) { throw Exception; } }